Skip to content

Commit

Permalink
feat: userToken 없이 folder페이지 접근시 로그인 페이지로 이동
Browse files Browse the repository at this point in the history
  • Loading branch information
namminimi committed Dec 10, 2023
1 parent 3620c89 commit 72bedbc
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pages/folder/folder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import ModalFolder from "@/modal/ModalFolder";
import { Links, folderOptionType } from "@/dataType/dataType";
import { AccountContext } from "@/contexts/AccountContext";
import styles from "./folder.module.css";
import { useRouter } from "next/router";

const modalBg = {
background: "#000",
Expand Down Expand Up @@ -48,6 +49,8 @@ const Folder = () => {
const { id } = account?.data[0];
const targetElement = useRef<HTMLDivElement>(null);
const targetSecondElement = useRef<HTMLDivElement>(null);
const userToken = window.localStorage.getItem("user");
const router = useRouter();

const { data: folderDataObject, errorMessage: foldersErrorMessage } =
useFetch(`users/${id}/folders`, id);
Expand Down Expand Up @@ -152,7 +155,11 @@ const Folder = () => {
});
}
};

if (!userToken) {
alert("로그인 해주세요");
router.push("/signin");
return;
}
return (
<>
<div className={styles.folder}>
Expand Down

0 comments on commit 72bedbc

Please sign in to comment.