mirror of
https://github.com/PlayEdu/backend
synced 2025-12-23 13:29:50 +08:00
重构
This commit is contained in:
@@ -1,7 +1,22 @@
|
||||
import { useDispatch } from "react-redux";
|
||||
import { Outlet } from "react-router-dom";
|
||||
import { loginAction } from "../../store/user/loginUserSlice";
|
||||
|
||||
const InitPage = () => {
|
||||
return <><Outlet /></>
|
||||
interface Props {
|
||||
loginData: any | null;
|
||||
}
|
||||
|
||||
const InitPage = (props: Props) => {
|
||||
const dispatch = useDispatch();
|
||||
if (props.loginData) {
|
||||
dispatch(loginAction(props.loginData));
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<Outlet />
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default InitPage;
|
||||
|
||||
Reference in New Issue
Block a user