Skip to content

Commit

Permalink
correction msg erreur sign in
Browse files Browse the repository at this point in the history
  • Loading branch information
MelanieSarrouy committed Nov 12, 2021
1 parent 55ef660 commit 080fba3
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/pages/SignIn.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ const SignIn = () => {

const [email, setEmail] = useState('')
const [password, setPassword] = useState('')
const [isLogged, setIsLogged] = useState(false)
const dispatch = useDispatch()
const selectMessage = (state) => state.getUser.user.status
const message = useSelector(selectMessage)
Expand All @@ -46,8 +45,8 @@ const SignIn = () => {
setInvalidFields('Please fill fields correctly')
} else {
dispatch(getToken(email, password))
setIsLogged(true)
if (isLogged && message === undefined) {
setInvalidFields('')
if (invalidFields === '' && message === undefined) {
setInvalidFields('Email or password invalid')
}
}
Expand Down

0 comments on commit 080fba3

Please sign in to comment.