Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sign up error handling #256

Merged
merged 5 commits into from
Oct 10, 2023
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export function SignUpFormContentComponent(props) {
handleSubmit,
watch,
getValues,
setError,
formState: { errors, isValid },
} = useForm({
mode: 'all',
Expand Down Expand Up @@ -83,12 +84,18 @@ export function SignUpFormContentComponent(props) {
axios({
method: 'post',
url: `${process.env.REACT_APP_BASE_API_URL}/api/auth/users/`,
withCredentials: false,
data: dataToSend
}).then(res => console.log(res.data)).catch(error => console.log(error));
console.log(process.env.REACT_APP_BASE_API_URL);
data: dataToSend,
})
.then()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to leave empty then here

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But should the user somehow be informed that registration is successfull?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will be used to trigger notification modal #262 as far as I know. That's why I decided to leave it even though it's empty.

.catch((error) => {
if (error.response.data.email) {
setError('email', {
type: 'manual',
message: 'Вже зареєстрована пошта',
});
}
});
};
// TODO: add error hndling (separate task)
// TODO: add modal about email being sent

return (
Expand Down
Loading