Skip to content

Commit

Permalink
fix: chat of unlogin
Browse files Browse the repository at this point in the history
  • Loading branch information
dolphin0618 committed Jun 20, 2024
1 parent 5774fd4 commit 06db327
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -172,14 +172,14 @@ export default function App() {

// 动态路由根据权限
const router = useMemo(() => {
if (['admin', 'group_admin'].includes(user.role)) return getAdminRouter()
if (user && ['admin', 'group_admin'].includes(user.role)) return getAdminRouter()
return user?.user_id ? getPrivateRouter(user.web_menu) : null
}, [user])

return (
//need parent component with width and height
<div className="flex h-full flex-col">
{(user?.user_id || noAuthPages.includes(path)) ? <RouterProvider router={router} />
{(user?.user_id || noAuthPages.includes(path)) && router ? <RouterProvider router={router} />
: user ? <div className="loading"></div>
: <RouterProvider router={publicRouter} />}
<div></div>
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/src/pages/ChatAppPage/chatShare.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default function chatShare() {
const params = [];

if (libId) params.push(`knowledge_id=${libId}`);
if (tweak) params.push(`tweak=${tweak}`);
if (tweak) params.push(`tweak=${encodeURIComponent(tweak)}`);

const paramStr = params.length > 0 ? `${params.join('&')}` : '';

Expand Down
1 change: 1 addition & 0 deletions src/frontend/src/routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ export const getAdminRouter = () => {
export const publicRouter = createBrowserRouter([
{ path: "/", element: <LoginPage /> },
{ path: "/reset", element: <ResetPwdPage /> },
{ path: "/chat/:id/", element: <ChatShare /> },
{ path: "*", element: <LoginPage /> }
],
baseConfig)

0 comments on commit 06db327

Please sign in to comment.