11import { useEffect , useState } from "react" ;
22import { useTranslation } from "react-i18next" ;
3+ import { isPlainObject } from "lodash-es" ;
34
45import SearchChat from "@/components/SearchChat" ;
56import { useAppStore } from "@/stores/appStore" ;
@@ -10,12 +11,11 @@ import useEscape from "@/hooks/useEscape";
1011import { useViewportHeight } from "@/hooks/useViewportHeight" ;
1112import type { StartPage } from "@/types/chat" ;
1213import ErrorNotification from "@/components/Common/ErrorNotification" ;
14+ import { Get } from "@/api/axiosRequest" ;
15+ import { useWebConfigStore } from "@/stores/webConfigStore" ;
1316
1417import "@/i18n" ;
1518import "@/web.css" ;
16- import { Get } from "@/api/axiosRequest" ;
17- import { useWebConfigStore } from "@/stores/webConfigStore" ;
18- import { isPlainObject } from "lodash-es" ;
1919
2020interface WebAppProps {
2121 headers ?: Record < string , unknown > ;
@@ -83,11 +83,14 @@ function WebApp({
8383 } = useWebConfigStore ( ) ;
8484
8585 const getUserProfile = async ( ) => {
86- const [ _ , result ] = await Get ( "/account/profile" ) ;
86+ const [ err , result ] = await Get ( "/account/profile" ) ;
8787
88- if ( isPlainObject ( result ) ) {
89- setLoginInfo ( result as any ) ;
88+ if ( err || ! isPlainObject ( result ) ) {
89+ setLoginInfo ( void 0 ) ;
90+ return ;
9091 }
92+
93+ setLoginInfo ( result as any ) ;
9194 } ;
9295
9396 useEffect ( ( ) => {
0 commit comments