feat: add user management

This commit is contained in:
Elias Schneider
2022-12-05 15:53:24 +01:00
parent 31b3f6cb2f
commit 7a3967fd6f
25 changed files with 751 additions and 47 deletions

View File

@@ -35,7 +35,7 @@ const SignInForm = () => {
authService
.signIn(email, password)
.then(() => window.location.replace("/"))
.catch((e) => toast.error(e.response.data.message));
.catch(toast.axiosError);
};
return (

View File

@@ -20,7 +20,7 @@ const SignUpForm = () => {
const validationSchema = yup.object().shape({
email: yup.string().email().required(),
username: yup.string().required(),
username: yup.string().min(3).required(),
password: yup.string().min(8).required(),
});
@@ -37,13 +37,13 @@ const SignUpForm = () => {
authService
.signIn(email, password)
.then(() => window.location.replace("/"))
.catch((e) => toast.error(e.response.data.message));
.catch(toast.axiosError);
};
const signUp = (email: string, username: string, password: string) => {
authService
.signUp(email, username, password)
.then(() => signIn(email, password))
.catch((e) => toast.error(e.response.data.message));
.catch(toast.axiosError);
};
return (