mirror of
https://github.com/documenso/documenso.git
synced 2025-11-20 11:41:44 +10:00
fix: invalidate sessions on password reset and update
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
import { type Page } from '@playwright/test';
|
||||
import type { Page } from '@playwright/test';
|
||||
|
||||
import { NEXT_PUBLIC_WEBAPP_URL } from '@documenso/lib/constants/app';
|
||||
|
||||
@ -58,3 +58,15 @@ const getCsrfToken = async (page: Page) => {
|
||||
|
||||
return csrfToken;
|
||||
};
|
||||
|
||||
export const checkSessionValid = async (page: Page): Promise<boolean> => {
|
||||
const { request } = page.context();
|
||||
|
||||
const response = await request.fetch(`${NEXT_PUBLIC_WEBAPP_URL()}/api/auth/session`, {
|
||||
method: 'get',
|
||||
});
|
||||
|
||||
const session = await response.json();
|
||||
|
||||
return session.isAuthenticated === true;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user