Re-export OAUTH_BASE from env var
This commit is contained in:
parent
d5caf3d784
commit
8166ee31dd
2 changed files with 6 additions and 2 deletions
4
src/lib/config.ts
Normal file
4
src/lib/config.ts
Normal 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
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import type { RequestHandler } from '@sveltejs/kit'
|
import type { RequestHandler } from '@sveltejs/kit'
|
||||||
import { json } from '@sveltejs/kit'
|
import { json } from '@sveltejs/kit'
|
||||||
import { PUBLIC_SIERO_OAUTH_URL } from '$env/static/public'
|
import { OAUTH_BASE } from '$lib/config'
|
||||||
import {
|
import {
|
||||||
getRefreshFromCookies,
|
getRefreshFromCookies,
|
||||||
setAccountCookie,
|
setAccountCookie,
|
||||||
|
|
@ -27,7 +27,7 @@ export const POST: RequestHandler = async ({ cookies, fetch, url }) => {
|
||||||
return json({ error: 'no_refresh_token' }, { status: 401 })
|
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',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue