修改获取用户数据逻辑

This commit is contained in:
hanhh
2021-09-11 02:03:31 +08:00
parent 35539a4ccc
commit 4147025406
2 changed files with 12 additions and 2 deletions
+6 -1
View File
@@ -47,13 +47,18 @@ export default function (props: any) {
});
};
useEffect(() => {
if (!user) {
getUser();
}
}, [props.location.pathname]);
useEffect(() => {
const isAuth = localStorage.getItem(config.authKey);
if (!isAuth) {
history.push('/login');
}
vhCheck();
getUser();
// patch custome layout title as react node [object, object]
document.title = '控制面板';