summaryrefslogtreecommitdiff
path: root/src/lib/auth/components/IsAuth.jsx
diff options
context:
space:
mode:
authorRafi Zadanly <zadanlyr@gmail.com>2023-03-29 14:29:29 +0700
committerRafi Zadanly <zadanlyr@gmail.com>2023-03-29 14:29:29 +0700
commit1d606fe88f97f87e32a58b1b187a71f40c70169c (patch)
tree3045839e7e9362f1b851d182614f6ed3ae04af80 /src/lib/auth/components/IsAuth.jsx
parentac230a35f325cc47e89fd5d635847536f2dd9b44 (diff)
blog detail
Diffstat (limited to 'src/lib/auth/components/IsAuth.jsx')
-rw-r--r--src/lib/auth/components/IsAuth.jsx4
1 files changed, 2 insertions, 2 deletions
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)
}