|
@@ -18,8 +18,7 @@ export const initialStateConfig = {
|
18
|
18
|
export async function getInitialState() {
|
19
|
19
|
const fetchUserInfo = async () => {
|
20
|
20
|
try {
|
21
|
|
- const { user } = await queryCurrentUser();
|
22
|
|
- return user;
|
|
21
|
+ return await queryCurrentUser();
|
23
|
22
|
} catch (error) {
|
24
|
23
|
history.push(loginPath);
|
25
|
24
|
}
|
|
@@ -28,10 +27,11 @@ export async function getInitialState() {
|
28
|
27
|
}; // 如果是登录页面,不执行
|
29
|
28
|
|
30
|
29
|
if (history.location.pathname !== loginPath) {
|
31
|
|
- const currentUser = await fetchUserInfo();
|
|
30
|
+ const res = await fetchUserInfo();
|
32
|
31
|
return {
|
33
|
32
|
fetchUserInfo,
|
34
|
|
- currentUser,
|
|
33
|
+ currentUser: res.user,
|
|
34
|
+ menuAccess: res.menu,
|
35
|
35
|
settings: {},
|
36
|
36
|
};
|
37
|
37
|
}
|