fix(overview): 修复首页未能正确展示用户名的问题

feature
钟良源 2 months ago
parent 6dad941b96
commit 8bc11c0de1

@ -61,7 +61,7 @@ function Overview() {
const [loading, setLoading] = useState(true); const [loading, setLoading] = useState(true);
const t = useLocale(locale); const t = useLocale(locale);
const userInfo = useSelector((state: any) => state.userInfo || {}); const userInfo = useSelector((state: any) => state.user?.userInfo || {});
const fetchData = async () => { const fetchData = async () => {
setLoading(true); setLoading(true);
@ -79,7 +79,7 @@ function Overview() {
<Card> <Card>
<Typography.Title heading={5}> <Typography.Title heading={5}>
{t['workplace.welcomeBack']} {t['workplace.welcomeBack']}
{userInfo.name} {userInfo.username}
</Typography.Title> </Typography.Title>
<Divider /> <Divider />
<Row> <Row>

@ -3,6 +3,7 @@ import { createSlice } from '@reduxjs/toolkit';
export interface UserState { export interface UserState {
userInfo?: { userInfo?: {
name?: string; name?: string;
username?: string;
avatar?: string; avatar?: string;
job?: string; job?: string;
organization?: string; organization?: string;

Loading…
Cancel
Save