Initial commit: Copilot Toolbox template project

This commit is contained in:
Evan
2026-01-09 10:49:51 +08:00
commit 0b4b053566
31 changed files with 12085 additions and 0 deletions

44
src/App.tsx Normal file
View File

@@ -0,0 +1,44 @@
import { RouterProvider } from 'react-router-dom'
import { useEffect } from 'react'
import router from '@/router'
import { cacheClear, cacheSet } from '@/utils/cacheUtil'
import { getAgentBaseInfo, getUserInfoById } from '@/api/common'
function App() {
const queryString = window.location.search
const searchParams = new URLSearchParams(queryString)
const tenantId = searchParams.get('tenantId') || ''
const token = searchParams.get('token') || ''
cacheSet('tenantId', tenantId)
cacheSet('token', token)
useEffect(() => {
const agentId = searchParams.get('agentId') || ''
if (agentId) {
getAgentBaseInfo({ id: agentId }).then(res => {
cacheSet('appKey', res.data.appKey)
})
}
}, [])
useEffect(() => {
if (tenantId && token) {
getUserInfoById().then(response => {
if (response.code === 200 && response.data) {
cacheSet('userInfo', JSON.stringify(response.data))
}
})
}
return () => {
cacheClear('userInfo')
}
}, [])
return (
<>
<RouterProvider router={router} />
</>
)
}
export default App