Skip to content

Commit 13f2340

Browse files
authored
Revert "[Feat] middleware로 토큰 유무에 따른 리다이렉트 설정"
1 parent d5687e7 commit 13f2340

4 files changed

Lines changed: 18 additions & 94 deletions

File tree

src/api/client.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,12 @@ authClient.interceptors.response.use(
8383
return Promise.reject(refreshError);
8484
}
8585
} else {
86-
// const accessToken = getAccessToken();
87-
// if (!accessToken) {
88-
// window.location.href = "/login";
89-
// } else {
90-
//window.location.href = "/error";
91-
// }
86+
const accessToken = getAccessToken();
87+
if (!accessToken) {
88+
window.location.href = "/login";
89+
} else {
90+
//window.location.href = "/error";
91+
}
9292
}
9393
return Promise.reject(error);
9494
}

src/app/page.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ export default function Home() {
1919
const router = useRouter();
2020
const accessToken = getAccessToken();
2121

22-
// useEffect(() => {
23-
// if (!accessToken) {
24-
// router.push("/login");
25-
// } else {
26-
// router.push("/planet");
27-
// }
28-
// }, []);
22+
useEffect(() => {
23+
if (!accessToken) {
24+
router.push("/login");
25+
} else {
26+
router.push("/planet");
27+
}
28+
}, []);
2929

3030
return (
3131
<Container>

src/app/planet/page.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -428,11 +428,11 @@ const PlanetPage = () => {
428428
};
429429

430430
//토큰 유효한지 확인
431-
// useEffect(() => {
432-
// if (!accessToken) {
433-
// router.push("/login");
434-
// }
435-
// }, []);
431+
useEffect(() => {
432+
if (!accessToken) {
433+
router.push("/login");
434+
}
435+
}, []);
436436

437437
return (
438438
<>

src/middleware.ts

Lines changed: 0 additions & 76 deletions
This file was deleted.

0 commit comments

Comments
 (0)