Skip to content

Commit

Permalink
fix: get user info
Browse files Browse the repository at this point in the history
  • Loading branch information
shanhexi committed Jan 3, 2024
1 parent 48553d2 commit 35fc7ed
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
10 changes: 8 additions & 2 deletions chat2db-client/src/layouts/GlobalLayout/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useLayoutEffect, useState } from 'react';
import React, { useEffect, useLayoutEffect, useState } from 'react';
import usePollRequestService, { ServiceStatus } from '@/hooks/usePollRequestService';
import i18n, { isEn } from '@/i18n';
import { Button, ConfigProvider, Spin, Tooltip } from 'antd';
Expand All @@ -14,7 +14,7 @@ import { GithubOutlined, SyncOutlined, WechatOutlined } from '@ant-design/icons'
import { ThemeType } from '@/constants';
import GlobalComponent from '../init/GlobalComponent';
import styles from './index.less';
import { useUserStore } from '@/store/user'
import { useUserStore, queryCurUser } from '@/store/user'

const GlobalLayout = () => {
const [appTheme, setAppTheme] = useTheme();
Expand All @@ -40,6 +40,12 @@ const GlobalLayout = () => {
monitorOsTheme();
}, []);

useEffect(() => {
if(serviceStatus === ServiceStatus.SUCCESS){
queryCurUser();
}
}, [serviceStatus]);

// 监听系统(OS)主题变化
const monitorOsTheme = () => {
function change(e: any) {
Expand Down
2 changes: 0 additions & 2 deletions chat2db-client/src/layouts/init/init.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { clearOlderLocalStorage } from '@/utils';
import initLoginInfo from './initLoginInfo';
import initIndexedDB from './initIndexedDB';
import registerElectronApi from './registerElectronApi';
import registerMessage from './registerMessage';
Expand All @@ -9,7 +8,6 @@ import { LangType } from '@/constants';

const init = () => {
clearOlderLocalStorage();
initLoginInfo();

initLang();
initIndexedDB();
Expand Down
8 changes: 0 additions & 8 deletions chat2db-client/src/layouts/init/initLoginInfo.tsx

This file was deleted.

0 comments on commit 35fc7ed

Please sign in to comment.