Skip to content

Commit

Permalink
Merge pull request #68 from Elizabethhub/feature/authv2.0
Browse files Browse the repository at this point in the history
add feature signup + signin
  • Loading branch information
Elizabethhub authored Mar 19, 2024
2 parents e7fe802 + df5d0dc commit 5784177
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/pages/RegistrationPage/RegistrationPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { yupResolver } from '@hookform/resolvers/yup';
import OpenPassEye from '../../images/AuthImg/OpenPassEye';
import { useState } from 'react';
import { useDispatch } from 'react-redux';
import { signUpThunk } from '../../store/auth/thunks';
import { signInThunk, signUpThunk } from '../../store/auth/thunks';
import { useNavigate } from 'react-router';
import { toast } from 'react-toastify';

Expand Down Expand Up @@ -65,8 +65,15 @@ const RegistrationPage = () => {
dispatch(signUpThunk({ email, password }))
.unwrap()
.then(() => {
toast.success('Sign up done!\nPlease login!');
navigate('/signin');
toast.success('Sign up done!');
dispatch(signInThunk({ email, password }))
.unwrap()
.then(() => {
navigate('/home');
})
.catch((err) => {
toast.error(err);
});
})

.catch(() => toast.error('Ooops... Something went wrong!'));
Expand Down

0 comments on commit 5784177

Please sign in to comment.