From 39cf9b2ed5d1de4d0cac744aa56cc033a8361845 Mon Sep 17 00:00:00 2001 From: "sosuke.iwabuchi" Date: Tue, 18 Jul 2023 21:45:33 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=AD=E3=82=B0=E3=82=A4=E3=83=B3=E6=B8=88?= =?UTF-8?q?=E3=81=BF=E3=81=AE404=E3=81=AFoverview=E7=94=BB=E9=9D=A2?= =?UTF-8?q?=E3=81=B8=E9=A3=9B=E3=81=B0=E3=81=99=E3=82=88=E3=81=86=E3=81=AB?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/common/Page404.tsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/pages/common/Page404.tsx b/src/pages/common/Page404.tsx index d87104d..4c1bf0e 100644 --- a/src/pages/common/Page404.tsx +++ b/src/pages/common/Page404.tsx @@ -1,5 +1,6 @@ import { Box } from "@mui/material"; import { PageID } from "codes/page"; +import useAuth from "hooks/useAuth"; import useNavigateCustom from "hooks/useNavigateCustom"; import { useEffect } from "react"; import { getPath } from "routes/path"; @@ -7,9 +8,15 @@ import { StoreId, getStore } from "storage/localstorage"; export default function Page404() { const { navigateWhenChanged } = useNavigateCustom(); + const { authenticated } = useAuth(); // ログインページにアクセス経験ある場合は、ログインページへ遷移させる useEffect(() => { + if (authenticated) { + navigateWhenChanged(getPath(PageID.DASHBOARD_OVERVIEW)); + return; + } + const canLoginRoute = !!getStore(StoreId.LOGIN_ROUTE); if (canLoginRoute) {