diff --git a/frontend/src/lib/utils/constants.ts b/frontend/src/lib/utils/constants.ts index 6a3d66317..3a4843a96 100644 --- a/frontend/src/lib/utils/constants.ts +++ b/frontend/src/lib/utils/constants.ts @@ -6,8 +6,6 @@ export const BASE_API_URL = `${ : 'http://localhost:8000/api' }`; -export const CI_TEST: boolean = Object.hasOwn(env, 'CI_TEST'); - export const ALLAUTH_API_URL = `${BASE_API_URL}/_allauth/app/v1`; export const BACKEND_API_EXPOSED_URL = `${ diff --git a/frontend/src/lib/utils/env_constants.ts b/frontend/src/lib/utils/env_constants.ts new file mode 100644 index 000000000..ac876fe77 --- /dev/null +++ b/frontend/src/lib/utils/env_constants.ts @@ -0,0 +1,3 @@ +import * as env from '$env/static/private'; + +export const CI_TEST: boolean = Object.hasOwn(env, 'CI_TEST'); diff --git a/frontend/src/routes/(app)/+page.server.ts b/frontend/src/routes/(app)/+page.server.ts index b180ce9b3..8cd76b570 100644 --- a/frontend/src/routes/(app)/+page.server.ts +++ b/frontend/src/routes/(app)/+page.server.ts @@ -1,11 +1,11 @@ import { redirect } from '@sveltejs/kit'; import type { PageServerLoad } from './$types'; -import { CI_TEST } from '$lib/utils/constants'; +import { CI_TEST } from '$lib/utils/env_constants'; const redirectURL = CI_TEST ? '/analytics' : '/analytics?refresh=1'; -console.log(`[NEW_REDIRECT:1] ${CI_TEST}`); +console.log(`[CI_TEST_VALUE:1] ${CI_TEST}`); export const load: PageServerLoad = async () => { - console.log(`[NEW_REDIRECT:2] ${CI_TEST}`); + console.log(`[CI_TEST_VALUE:2] ${CI_TEST}`); redirect(301, redirectURL); }; diff --git a/frontend/src/routes/(authentication)/login/+page.server.ts b/frontend/src/routes/(authentication)/login/+page.server.ts index 6df6a6dde..ff4549dd4 100644 --- a/frontend/src/routes/(authentication)/login/+page.server.ts +++ b/frontend/src/routes/(authentication)/login/+page.server.ts @@ -1,6 +1,7 @@ import { getSecureRedirect } from '$lib/utils/helpers'; -import { ALLAUTH_API_URL, BASE_API_URL, CI_TEST } from '$lib/utils/constants'; +import { ALLAUTH_API_URL, BASE_API_URL } from '$lib/utils/constants'; +import { CI_TEST } from '$lib/utils/env_constants'; import { loginSchema } from '$lib/utils/schemas'; import type { LoginRequestBody } from '$lib/utils/types'; import { fail, redirect, type Actions } from '@sveltejs/kit'; @@ -132,7 +133,6 @@ export const actions: Actions = { const next = url.searchParams.get('next') || '/'; const redirectURL = getSecureRedirect(next) + (CI_TEST ? '' : '?refresh=1'); - console.log(`[NEW_REDIRECT:3] ${redirectURL}`); redirect(302, redirectURL); }, mfaAuthenticate: async (event) => {