From 67097bae5fbe7816ac65287a2ee03f81fb45f71c Mon Sep 17 00:00:00 2001 From: yst <77910600+yu-and-liu@users.noreply.github.com> Date: Tue, 19 Mar 2024 10:53:36 +0800 Subject: [PATCH] fix team share redirect to login (#51) --- projects/app/src/pages/api/core/chat/updateHistory.ts | 5 +++-- projects/app/src/web/common/api/request.ts | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/projects/app/src/pages/api/core/chat/updateHistory.ts b/projects/app/src/pages/api/core/chat/updateHistory.ts index 634604894e3..7a434d7ac3d 100644 --- a/projects/app/src/pages/api/core/chat/updateHistory.ts +++ b/projects/app/src/pages/api/core/chat/updateHistory.ts @@ -9,12 +9,13 @@ import { autChatCrud } from '@/service/support/permission/auth/chat'; export default async function handler(req: NextApiRequest, res: NextApiResponse) { try { await connectToDatabase(); - const { appId, chatId, shareId, outLinkUid, customTitle, top } = req.body as UpdateHistoryProps; - + const { appId, chatId, teamId, shareId, outLinkUid, customTitle, top } = + req.body as UpdateHistoryProps; await autChatCrud({ req, authToken: true, appId, + teamId, chatId, shareId, outLinkUid, diff --git a/projects/app/src/web/common/api/request.ts b/projects/app/src/web/common/api/request.ts index 39b6b3112e8..489fefaf746 100644 --- a/projects/app/src/web/common/api/request.ts +++ b/projects/app/src/web/common/api/request.ts @@ -102,7 +102,9 @@ function responseError(err: any) { if (err?.code in TOKEN_ERROR_CODE) { clearToken(); - if (window.location.pathname !== '/chat/share') { + if ( + !(window.location.pathname === '/chat/share' || window.location.pathname === '/chat/team') + ) { window.location.replace( `/login?lastRoute=${encodeURIComponent(location.pathname + location.search)}` );