From 1d606fe88f97f87e32a58b1b187a71f40c70169c Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Wed, 29 Mar 2023 14:29:29 +0700 Subject: blog detail --- src/lib/auth/components/IsAuth.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/lib/auth/components') diff --git a/src/lib/auth/components/IsAuth.jsx b/src/lib/auth/components/IsAuth.jsx index 1cfd3172..a32e648c 100644 --- a/src/lib/auth/components/IsAuth.jsx +++ b/src/lib/auth/components/IsAuth.jsx @@ -7,8 +7,8 @@ const IsAuth = ({ children }) => { const [response, setResponse] = useState(<>) useEffect(() => { - if (!getAuth()) { - router.replace('/login') + if (!getAuth() && router.pathname != '/login') { + router.replace(`/login?next=${router.asPath}`) } else { setResponse(children) } -- cgit v1.2.3