Skip to content

Commit

Permalink
merge: 후면 기능 전환 추가 위한 병합
Browse files Browse the repository at this point in the history
  • Loading branch information
Catleap02 committed Nov 15, 2024
2 parents 440756e + 275c1c5 commit ecbef5c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
4 changes: 4 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
rel="stylesheet"
/>
<meta name="theme-color" content="#000000" />
<meta
http-equiv="Content-Security-Policy"
content="upgrade-insecure-requests"
/>
<meta
name="description"
content="해양 생물들을 촬영하여 나만의 도감을 채워나가는 체험형 교육 서비스, 물멍"
Expand Down
22 changes: 10 additions & 12 deletions src/routes/TokenRouter.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
import {Outlet, useLocation, useNavigate} from "react-router-dom";
import { Outlet, useLocation, useNavigate } from "react-router-dom";

import { useEffect } from "react";
const TokenRouter = () => {

const location = useLocation();
const location = useLocation();
const navigate = useNavigate();
const isAuthPath = location.pathname === "/login" || location.pathname === "/signup";


// useEffect(() => {
// if(!localStorage.getItem("accessToken") && !isAuthPath){
// navigate("/login");
// }
const isAuthPath =
location.pathname === "/login" || location.pathname === "/signup";

// }, [location.pathname, isAuthPath, navigate]);
useEffect(() => {
if (!localStorage.getItem("accessToken") && !isAuthPath) {
navigate("/login");
}
}, [location.pathname, isAuthPath, navigate]);
return (
<div>
<Outlet />
<Outlet />
</div>
);
};
Expand Down

0 comments on commit ecbef5c

Please sign in to comment.