diff --git a/chat2db-client/src/pages/main/index.tsx b/chat2db-client/src/pages/main/index.tsx index c0e7853a3..b619e3ea5 100644 --- a/chat2db-client/src/pages/main/index.tsx +++ b/chat2db-client/src/pages/main/index.tsx @@ -59,6 +59,14 @@ const initNavConfig: INavItem[] = [ component: , name: i18n('connection.title'), }, + { + key: 'team', + icon: '\ue64b', + iconFontSize: 24, + isLoad: false, + component: , + name: i18n('team.title'), + }, { key: 'github', icon: '\ue885', @@ -99,7 +107,6 @@ function MainPage() { }, [mainPageActiveTab]); useEffect(() => { - handleInitPage(); getConnectionList(); getConnectionEnvList(); }, []); @@ -122,27 +129,6 @@ function MainPage() { } }, [activeNavKey]); - const handleInitPage = async () => { - const cloneNavConfig = [...navConfig]; - if (userInfo) { - const hasTeamIcon = cloneNavConfig.find((i) => i.key === 'team'); - if (userInfo.admin && !hasTeamIcon) { - cloneNavConfig.splice(3, 0, { - key: 'team', - icon: '\ue64b', - iconFontSize: 24, - isLoad: activeNavKey === 'team', // 如果当前是team,直接加载 - component: , - name: i18n('team.title'), - }); - } - if (!userInfo.admin && hasTeamIcon) { - cloneNavConfig.splice(3, 1); - } - } - setNavConfig([...cloneNavConfig]); - }; - const switchingNav = (key: string) => { if (key === 'github') { window.open('https://github.com/chat2db/Chat2DB/', '_blank'); @@ -191,6 +177,12 @@ function MainPage() { {(isMac === void 0) && }
    {navConfig.map((item) => { + if (item.key === 'team') { + if (!userInfo || !userInfo.admin) { + return; + } + } + return (