Skip to content

Commit 74d6656

Browse files
committed
feat: logout for non secured
1 parent 725ce40 commit 74d6656

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

apps/backend/src/api/routes/users.controller.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ export class UsersController {
199199

200200
@Post('/logout')
201201
logout(@Res({ passthrough: true }) response: Response) {
202+
response.header('logout', 'true');
202203
response.cookie('auth', '', {
203204
domain: getCookieUrlFromDomain(process.env.FRONTEND_URL!),
204205
...(!process.env.NOT_SECURED

apps/frontend/src/components/layout/layout.context.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,13 @@ function LayoutContextInner(params: { children: ReactNode }) {
7373
: '/analytics?onboarding=true';
7474
return true;
7575
}
76+
7677
if (response?.headers?.get('reload')) {
7778
window.location.reload();
7879
return true;
7980
}
80-
if (response.status === 401) {
81+
82+
if (response.status === 401 || response?.headers?.get('logout')) {
8183
if (!isSecured) {
8284
setCookie('auth', '', -10);
8385
setCookie('showorg', '', -10);

0 commit comments

Comments
 (0)