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