| @@ -1,5 +1,6 @@ | |||||
| import { Box } from "@mui/material"; | import { Box } from "@mui/material"; | ||||
| import { PageID } from "codes/page"; | import { PageID } from "codes/page"; | ||||
| import useAuth from "hooks/useAuth"; | |||||
| import useNavigateCustom from "hooks/useNavigateCustom"; | import useNavigateCustom from "hooks/useNavigateCustom"; | ||||
| import { useEffect } from "react"; | import { useEffect } from "react"; | ||||
| import { getPath } from "routes/path"; | import { getPath } from "routes/path"; | ||||
| @@ -7,9 +8,15 @@ import { StoreId, getStore } from "storage/localstorage"; | |||||
| export default function Page404() { | export default function Page404() { | ||||
| const { navigateWhenChanged } = useNavigateCustom(); | const { navigateWhenChanged } = useNavigateCustom(); | ||||
| const { authenticated } = useAuth(); | |||||
| // ログインページにアクセス経験ある場合は、ログインページへ遷移させる | // ログインページにアクセス経験ある場合は、ログインページへ遷移させる | ||||
| useEffect(() => { | useEffect(() => { | ||||
| if (authenticated) { | |||||
| navigateWhenChanged(getPath(PageID.DASHBOARD_OVERVIEW)); | |||||
| return; | |||||
| } | |||||
| const canLoginRoute = !!getStore(StoreId.LOGIN_ROUTE); | const canLoginRoute = !!getStore(StoreId.LOGIN_ROUTE); | ||||
| if (canLoginRoute) { | if (canLoginRoute) { | ||||