From 5fb085bdcefdcad0f34f5cbf97adc0003864dcff Mon Sep 17 00:00:00 2001 From: Towfiq Date: Fri, 25 Nov 2022 09:21:07 +0600 Subject: [PATCH] Fixed: Redirect when not logged in. --- pages/index.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pages/index.tsx b/pages/index.tsx index e1e2518..7063ac1 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -17,6 +17,9 @@ const Home: NextPage = () => { setLoading(true); fetch(`${process.env.NEXT_PUBLIC_APP_URL}/api/domains`) .then((result) => { + if (result.status === 401) { + router.push('/login'); + } return result.json(); }) .then((domainsRes:any) => {