mirror of
https://github.com/documenso/documenso.git
synced 2025-11-18 02:32:00 +10:00
fix: wip
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
import { type Page } from '@playwright/test';
|
||||
|
||||
import { WEBAPP_BASE_URL } from '@documenso/lib/constants/app';
|
||||
import { NEXT_PUBLIC_WEBAPP_URL } from '@documenso/lib/constants/app';
|
||||
|
||||
type LoginOptions = {
|
||||
page: Page;
|
||||
@ -23,7 +23,7 @@ export const apiSignin = async ({
|
||||
|
||||
const csrfToken = await getCsrfToken(page);
|
||||
|
||||
await request.post(`${WEBAPP_BASE_URL}/api/auth/callback/credentials`, {
|
||||
await request.post(`${NEXT_PUBLIC_WEBAPP_URL()}/api/auth/callback/credentials`, {
|
||||
form: {
|
||||
email,
|
||||
password,
|
||||
@ -32,7 +32,7 @@ export const apiSignin = async ({
|
||||
},
|
||||
});
|
||||
|
||||
await page.goto(`${WEBAPP_BASE_URL}${redirectPath}`);
|
||||
await page.goto(`${NEXT_PUBLIC_WEBAPP_URL()}${redirectPath}`);
|
||||
};
|
||||
|
||||
export const apiSignout = async ({ page }: { page: Page }) => {
|
||||
@ -40,20 +40,20 @@ export const apiSignout = async ({ page }: { page: Page }) => {
|
||||
|
||||
const csrfToken = await getCsrfToken(page);
|
||||
|
||||
await request.post(`${WEBAPP_BASE_URL}/api/auth/signout`, {
|
||||
await request.post(`${NEXT_PUBLIC_WEBAPP_URL()}/api/auth/signout`, {
|
||||
form: {
|
||||
csrfToken,
|
||||
json: true,
|
||||
},
|
||||
});
|
||||
|
||||
await page.goto(`${WEBAPP_BASE_URL}/signin`);
|
||||
await page.goto(`${NEXT_PUBLIC_WEBAPP_URL()}/signin`);
|
||||
};
|
||||
|
||||
const getCsrfToken = async (page: Page) => {
|
||||
const { request } = page.context();
|
||||
|
||||
const response = await request.fetch(`${WEBAPP_BASE_URL}/api/auth/csrf`, {
|
||||
const response = await request.fetch(`${NEXT_PUBLIC_WEBAPP_URL()}/api/auth/csrf`, {
|
||||
method: 'get',
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user