fix: fix Avatar display
This commit is contained in:
parent
9b0db2cd2f
commit
a582592490
@ -42,7 +42,7 @@ export const layout: RunTimeLayoutConfig = ({ initialState, setInitialState }) =
|
||||
src: initialState?.currentUser?.userAvatar,
|
||||
title: <AvatarName />,
|
||||
render: (_, avatarChildren) => {
|
||||
return <AvatarDropdown>{avatarChildren}</AvatarDropdown>;
|
||||
return <AvatarDropdown initState={initialState}>{avatarChildren}</AvatarDropdown>;
|
||||
},
|
||||
},
|
||||
waterMarkProps: {
|
||||
@ -111,7 +111,7 @@ export const layout: RunTimeLayoutConfig = ({ initialState, setInitialState }) =
|
||||
* @doc https://umijs.org/docs/max/request#配置
|
||||
*/
|
||||
export const request = {
|
||||
|
||||
|
||||
baseURL:"http://localhost:8101",
|
||||
withCredentials:true,
|
||||
...errorConfig,
|
||||
|
@ -38,7 +38,8 @@ const useStyles = createStyles(({ token }) => {
|
||||
};
|
||||
});
|
||||
|
||||
export const AvatarDropdown: React.FC<GlobalHeaderRightProps> = ({ menu, children }) => {
|
||||
export const AvatarDropdown: React.FC<GlobalHeaderRightProps> = ({ menu,initState, children }) => {
|
||||
|
||||
/**
|
||||
* 退出登录,并且将当前的 url 保存
|
||||
*/
|
||||
@ -89,11 +90,13 @@ export const AvatarDropdown: React.FC<GlobalHeaderRightProps> = ({ menu, childre
|
||||
</span>
|
||||
);
|
||||
|
||||
if (!initialState) {
|
||||
return loading;
|
||||
}
|
||||
// if (!initialState) {
|
||||
// return loading;
|
||||
// }
|
||||
|
||||
const { currentUser } = initialState;
|
||||
const { currentUser } = initState;
|
||||
|
||||
console.log('currentUser:',currentUser,initState)
|
||||
|
||||
if (!currentUser || !currentUser.userName) {
|
||||
return loading;
|
||||
@ -135,4 +138,4 @@ export const AvatarDropdown: React.FC<GlobalHeaderRightProps> = ({ menu, childre
|
||||
{children}
|
||||
</HeaderDropdown>
|
||||
);
|
||||
};
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user