Skip to content
Snippets Groups Projects
Commit 8e67bd52 authored by Stephanie Briere Americo's avatar Stephanie Briere Americo
Browse files

Merge branch 'issue/30' into 'development'

Issue #30: Add redirects and adjusting others

See merge request !32
parents 606d8a1d 14e0bc39
No related branches found
No related tags found
3 merge requests!58Version 1.1,!54Issue #53: Fix password info,!32Issue #30: Add redirects and adjusting others
......@@ -109,7 +109,11 @@ export default function Header() {
</Grid>
</Grid>
<Grid container item xs={6} sm={6} md={4} justify="center">
<a className={classes.link}>
<a
href="https://genforms.c3sl.ufpr.br/"
title="Home"
className={classes.link}
>
<h2 className={classes.form_creator}>
Gerenciador de Formulários
</h2>
......
......@@ -8,7 +8,7 @@ import {
selectOptionsTesting,
testSubformSchema,
selectOptionTextTesting,
testTextValidation,
testTextValidation
} from "../components/fieldsDisplayForm/utils/schemas";
import {
pushTitle,
......@@ -16,7 +16,7 @@ import {
pushSelect,
pushRadio,
pushCheckbox,
pushSubform,
pushSubform
} from "../components/fieldsDisplayForm/utils/FormComposition";
import api from "../api";
......@@ -248,13 +248,13 @@ const useForm = () => {
"question",
"description",
"options",
"subformId",
"subformId"
]) !==
JSON.stringify(form[j], [
"question",
"description",
"options",
"subformId",
"subformId"
]) ||
differentValidation(backForm[i], form[j])
) {
......@@ -279,12 +279,15 @@ const useForm = () => {
const post_response = await api
.put(`/form/${routeId}`, data, {
headers: {
authorization: `bearer ${window.sessionStorage.getItem("token")}`,
},
authorization: `bearer ${window.sessionStorage.getItem("token")}`
}
})
.then(function(error) {
if (!error.response)
if (!error.response) {
alert("Seu formulário foi atualizado com sucesso.");
let path = `/signin`;
history.push(path);
}
})
.catch(function(error) {
if (error.response.status === 401) {
......@@ -304,11 +307,15 @@ const useForm = () => {
const post_response = await api
.post(`/form`, await createBackendForm(form), {
headers: {
authorization: `bearer ${window.sessionStorage.getItem("token")}`,
},
authorization: `bearer ${window.sessionStorage.getItem("token")}`
}
})
.then(function(error) {
if (!error.response) alert("Seu formulário foi criado com sucesso.");
if (!error.response) {
alert("Seu formulário foi criado com sucesso.");
let path = `/signin`;
history.push(path);
}
})
.catch(function(error) {
alert("Um erro ocorreu.");
......@@ -336,7 +343,7 @@ const useForm = () => {
setValidationValue,
removeValidation,
onDragEnd,
submit,
submit
};
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment