Skip to content

Commit

Permalink
Test: S3 라우트 이동 테스트
Browse files Browse the repository at this point in the history
  • Loading branch information
milkbottle0305 committed Mar 17, 2024
1 parent b5d7002 commit 7b7323a
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions src/pages/PrivateRoute/PrivateRoute.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,22 @@ function PrivateRoute({ authentication }) {
const [isAuthenticated, setIsAuthenticated] = useState(null);
const [loading, setLoading] = useState(true);
useEffect(() => {
const checkAuthentication = async () => {
try {
const isAuthenticated = await validateToken(
localStorage.getItem("studitAccessToken"),
);
setIsAuthenticated(isAuthenticated);
} catch (error) {
setIsAuthenticated(false);
} finally {
setLoading(false); // 비동기 작업 완료 후 로딩 상태 변경
}
};
setIsAuthenticated(true);
setLoading(false);
// const checkAuthentication = async () => {
// try {
// const isAuthenticated = await validateToken(
// localStorage.getItem("studitAccessToken"),
// );
// setIsAuthenticated(isAuthenticated);
// } catch (error) {
// setIsAuthenticated(false);
// } finally {
// setLoading(false); // 비동기 작업 완료 후 로딩 상태 변경
// }
// };

checkAuthentication();
// checkAuthentication();
}, []);

if (loading) {
Expand Down

0 comments on commit 7b7323a

Please sign in to comment.