From 9081f2b5dcd587197aaadff1af35e5fcb6f48a64 Mon Sep 17 00:00:00 2001 From: Ashelyn Dawn Date: Mon, 27 Apr 2020 18:47:04 -0600 Subject: [PATCH] Admins get redirected to admin dashboard --- pages/login.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pages/login.js b/pages/login.js index bf56396..ed26716 100644 --- a/pages/login.js +++ b/pages/login.js @@ -9,8 +9,15 @@ import useAccountRedirect from '~/hooks/useAccountRedirect' export default function Login(){ useAccountRedirect() + const redirectAfterLogin = user => { + if (user.is_admin) + Router.push('/admin') + else + Router.push('/account') + } + return ( - Router.push('/account')}> +

Login

isEmail(value)} hint="Enter a valid email address" /> (value.length >= 8)} hint="Password must be at least 8 characters long" />