From 8166ee31dda69e7385e7e35bee09edf51475aeb1 Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Tue, 9 Sep 2025 03:20:27 -0700 Subject: [PATCH] Re-export OAUTH_BASE from env var --- src/lib/config.ts | 4 ++++ src/routes/auth/refresh/+server.ts | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 src/lib/config.ts diff --git a/src/lib/config.ts b/src/lib/config.ts new file mode 100644 index 00000000..e58ca965 --- /dev/null +++ b/src/lib/config.ts @@ -0,0 +1,4 @@ +import { PUBLIC_SIERO_OAUTH_URL } from '$env/static/public' + +// Single source of truth for env-based URLs +export const OAUTH_BASE = PUBLIC_SIERO_OAUTH_URL diff --git a/src/routes/auth/refresh/+server.ts b/src/routes/auth/refresh/+server.ts index 25ad6433..9367c58c 100644 --- a/src/routes/auth/refresh/+server.ts +++ b/src/routes/auth/refresh/+server.ts @@ -1,6 +1,6 @@ import type { RequestHandler } from '@sveltejs/kit' import { json } from '@sveltejs/kit' -import { PUBLIC_SIERO_OAUTH_URL } from '$env/static/public' +import { OAUTH_BASE } from '$lib/config' import { getRefreshFromCookies, setAccountCookie, @@ -27,7 +27,7 @@ export const POST: RequestHandler = async ({ cookies, fetch, url }) => { return json({ error: 'no_refresh_token' }, { status: 401 }) } - const res = await fetch(`${PUBLIC_SIERO_OAUTH_URL}/token`, { + const res = await fetch(`${OAUTH_BASE}/token`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({