Skip to content

Commit

Permalink
Merge pull request #366 from refly-ai/fix/online-logout
Browse files Browse the repository at this point in the history
Fix/online logout
  • Loading branch information
mrcfps authored Jan 14, 2025
2 parents cd86437 + 9f52af8 commit b99a948
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
20 changes: 17 additions & 3 deletions apps/api/src/auth/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,23 @@ export class AuthService {

clearAuthCookie(res: Response) {
return res
.clearCookie(UID_COOKIE)
.clearCookie(ACCESS_TOKEN_COOKIE)
.clearCookie(REFRESH_TOKEN_COOKIE);
.clearCookie(UID_COOKIE, {
domain: this.configService.get('auth.cookieDomain'),
secure: true,
sameSite: 'strict',
})
.clearCookie(ACCESS_TOKEN_COOKIE, {
domain: this.configService.get('auth.cookieDomain'),
httpOnly: true,
secure: true,
sameSite: 'strict',
})
.clearCookie(REFRESH_TOKEN_COOKIE, {
domain: this.configService.get('auth.cookieDomain'),
httpOnly: true,
secure: true,
sameSite: 'strict',
});
}

async genUniqueUsername(candidate: string) {
Expand Down
8 changes: 7 additions & 1 deletion packages/ai-workspace-common/src/utils/notification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { IconCopy } from '@refly-packages/ai-workspace-common/components/common/
import React from 'react';
import { Button, notification } from 'antd';
import { LOCALE } from '@refly/common-types';
import { getErrorMessage } from '@refly/errors';
import { ActionResultNotFoundError, getErrorMessage } from '@refly/errors';

import { UnknownError } from '@refly/errors';
import { BaseResponse } from '@refly/openapi-schema';
Expand All @@ -13,8 +13,14 @@ const errTitle = {
'zh-CN': '哎呀,出错了',
};

const ignoredErrorCodes = [new ActionResultNotFoundError().code];

export const showErrorNotification = (res: BaseResponse, locale: LOCALE) => {
const { errCode, traceId } = res;
if (ignoredErrorCodes.includes(errCode)) {
return;
}

const errMsg = getErrorMessage(errCode || new UnknownError().code, locale);

const description = React.createElement(
Expand Down

0 comments on commit b99a948

Please sign in to comment.