From 25232b1854b243d2c741c64645c8b80c0090a88c Mon Sep 17 00:00:00 2001 From: Gareth Redfern Date: Fri, 11 Feb 2022 21:22:01 +0000 Subject: [PATCH] add js strict equality --- src/components/Layouts/Navigation.js | 4 ++-- src/hooks/auth.js | 10 +++++----- src/pages/login.js | 2 +- src/pages/verify-email.js | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/components/Layouts/Navigation.js b/src/components/Layouts/Navigation.js index 81b1eb8..743f192 100644 --- a/src/components/Layouts/Navigation.js +++ b/src/components/Layouts/Navigation.js @@ -34,7 +34,7 @@ const Navigation = ({ user }) => {
+ active={router.pathname === '/dashboard'}> Dashboard
@@ -110,7 +110,7 @@ const Navigation = ({ user }) => {
+ active={router.pathname === '/dashboard'}> Dashboard
diff --git a/src/hooks/auth.js b/src/hooks/auth.js index 923a6ae..bf13ab3 100644 --- a/src/hooks/auth.js +++ b/src/hooks/auth.js @@ -28,7 +28,7 @@ export const useAuth = ({ middleware, redirectIfAuthenticated } = {}) => { .post('/register', props) .then(() => revalidate()) .catch(error => { - if (error.response.status != 422) throw error + if (error.response.status !== 422) throw error setErrors(Object.values(error.response.data.errors).flat()) }) @@ -44,7 +44,7 @@ export const useAuth = ({ middleware, redirectIfAuthenticated } = {}) => { .post('/login', props) .then(() => revalidate()) .catch(error => { - if (error.response.status != 422) throw error + if (error.response.status !== 422) throw error setErrors(Object.values(error.response.data.errors).flat()) }) @@ -60,7 +60,7 @@ export const useAuth = ({ middleware, redirectIfAuthenticated } = {}) => { .post('/forgot-password', { email }) .then(response => setStatus(response.data.status)) .catch(error => { - if (error.response.status != 422) throw error + if (error.response.status !== 422) throw error setErrors(Object.values(error.response.data.errors).flat()) }) @@ -99,8 +99,8 @@ export const useAuth = ({ middleware, redirectIfAuthenticated } = {}) => { } useEffect(() => { - if (middleware == 'guest' && redirectIfAuthenticated && user) router.push(redirectIfAuthenticated) - if (middleware == 'auth' && error) logout() + if (middleware === 'guest' && redirectIfAuthenticated && user) router.push(redirectIfAuthenticated) + if (middleware === 'auth' && error) logout() }, [user, error]) return { diff --git a/src/pages/login.js b/src/pages/login.js index 77886c2..44844a5 100644 --- a/src/pages/login.js +++ b/src/pages/login.js @@ -25,7 +25,7 @@ const Login = () => { const [status, setStatus] = useState(null) useEffect(() => { - if (router.query.reset?.length > 0 && errors.length == 0) { + if (router.query.reset?.length > 0 && errors.length === 0) { setStatus(atob(router.query.reset)) } else { setStatus(null) diff --git a/src/pages/verify-email.js b/src/pages/verify-email.js index 547d7cd..584eb71 100644 --- a/src/pages/verify-email.js +++ b/src/pages/verify-email.js @@ -31,7 +31,7 @@ const VerifyEmail = () => { gladly send you another. - {status == 'verification-link-sent' && ( + {status === 'verification-link-sent' && (
A new verification link has been sent to the email address you provided during registration.