Re-export OAUTH_BASE from env var

This commit is contained in:
Justin Edmund 2025-09-09 03:20:27 -07:00
parent d5caf3d784
commit 8166ee31dd
2 changed files with 6 additions and 2 deletions

4
src/lib/config.ts Normal file
View file

@ -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

View file

@ -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({