Skip to content

Commit

Permalink
fix team share redirect to login (labring#51)
Browse files Browse the repository at this point in the history
  • Loading branch information
yu-and-liu authored Mar 19, 2024
1 parent a5d6ca6 commit 67097ba
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 3 additions & 2 deletions projects/app/src/pages/api/core/chat/updateHistory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 3 additions & 1 deletion projects/app/src/web/common/api/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)}`
);
Expand Down

0 comments on commit 67097ba

Please sign in to comment.