From 7f70cb15d035f0c233b9e62b9e43aa985317c908 Mon Sep 17 00:00:00 2001 From: luxiaotao1123 <t1341870251@163.com> Date: 星期一, 04 十一月 2024 10:22:45 +0800 Subject: [PATCH] # --- zy-acs-flow/src/page/dashboard/Dashboard.jsx | 15 ++++++++------- 1 files changed, 8 insertions(+), 7 deletions(-) diff --git a/zy-acs-flow/src/page/dashboard/Dashboard.jsx b/zy-acs-flow/src/page/dashboard/Dashboard.jsx index d5b9bd2..1c9389f 100644 --- a/zy-acs-flow/src/page/dashboard/Dashboard.jsx +++ b/zy-acs-flow/src/page/dashboard/Dashboard.jsx @@ -1,20 +1,21 @@ import React, { useState, useRef, useEffect, useMemo } from "react"; +import { useNavigate } from 'react-router-dom'; +import { useAuthProvider } from 'react-admin'; import MapPage from "../../map/MapPage"; -import Player from "../../map/player"; - - const Dashboard = () => { - const mapRef = React.useRef(); + const authProvider = useAuthProvider(); + const navigate = useNavigate(); useEffect(() => { - // let player = new Player(mapRef.current) - }, []) + authProvider.checkAuth().catch(() => { + navigate('/login'); + }); + }, [authProvider, navigate]); return ( <> <MapPage /> - {/* <div ref={mapRef} ></div> */} </> ) } -- Gitblit v1.9.1