update survey and questions
This commit is contained in:
parent
4c4e6ee619
commit
51f3469031
5 changed files with 122 additions and 40 deletions
|
|
@ -31,17 +31,22 @@ const RegisterForm = () => {
|
|||
setError(null);
|
||||
|
||||
try{
|
||||
const responseData = await registerUser({username, firstName, lastName, email, password});
|
||||
if (responseData && !responseData.error) {
|
||||
console.log('Регистрация успешна');
|
||||
localStorage.setItem("user", JSON.stringify({
|
||||
firstName,
|
||||
lastName
|
||||
}));
|
||||
navigate('/my-surveys');
|
||||
if (email === '' || password === '' || firstName === '' || lastName === '') {
|
||||
setError('Заполните все поля');
|
||||
}
|
||||
else if (responseData.status === 409){
|
||||
setError('Аккаунт с такой почтой уже зарегистрирован');
|
||||
else{
|
||||
const responseData = await registerUser({username, firstName, lastName, email, password});
|
||||
if (responseData && !responseData.error) {
|
||||
console.log('Регистрация успешна');
|
||||
localStorage.setItem("user", JSON.stringify({
|
||||
firstName,
|
||||
lastName
|
||||
}));
|
||||
navigate('/my-surveys');
|
||||
}
|
||||
else if (responseData.status === 409){
|
||||
setError('Аккаунт с такой почтой уже зарегистрирован');
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue