Skip to content

Commit 251561d

Browse files
committed
Fix: 토큰없을 때 로그인페이지로 리다이렉트 적용
1 parent 713b8ad commit 251561d

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

pages/favorite/index.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,15 @@ export const getServerSideProps: GetServerSideProps = async (
3535
const accessToken = cookies.accessToken;
3636

3737
try {
38+
if (!accessToken) {
39+
return {
40+
redirect: {
41+
destination: "/login",
42+
permanent: false,
43+
},
44+
};
45+
}
46+
3847
const res = await axiosInstance.get("/favorites", {
3948
headers: { Authorization: `Bearer ${accessToken}` },
4049
});

0 commit comments

Comments
 (0)