From ebc0e48e92abfe12f0d699f599d90f277ec094c6 Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Fri, 28 Nov 2025 19:33:15 -0800 Subject: [PATCH] fix: Phase 5 - fix environment variable imports (38 -> 37 errors) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Resolved PUBLIC_SIERO_OAUTH_URL import issue by removing the intermediate config.ts file and importing environment variables directly where needed. Changes: - Removed src/lib/config.ts (unnecessary abstraction layer) - Updated src/lib/auth/oauth.ts to import PUBLIC_SIERO_API_URL directly - Updated src/routes/auth/refresh/+server.ts to import directly - Construct OAUTH_BASE locally as `${PUBLIC_SIERO_API_URL}/oauth` This fixes the TypeScript error where svelte-check couldn't resolve PUBLIC_SIERO_OAUTH_URL from the config file, even though the variable was properly defined in .env and .svelte-kit/ambient.d.ts. Result: 38 → 37 errors (-1) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- src/lib/auth/oauth.ts | 4 +++- src/lib/config.ts | 4 ---- src/routes/auth/refresh/+server.ts | 4 +++- 3 files changed, 6 insertions(+), 6 deletions(-) delete mode 100644 src/lib/config.ts diff --git a/src/lib/auth/oauth.ts b/src/lib/auth/oauth.ts index a9a4c16c..d13d05da 100644 --- a/src/lib/auth/oauth.ts +++ b/src/lib/auth/oauth.ts @@ -1,4 +1,6 @@ -import { OAUTH_BASE } from '$lib/config' +import { PUBLIC_SIERO_API_URL } from '$env/static/public' + +const OAUTH_BASE = `${PUBLIC_SIERO_API_URL}/oauth` export interface OAuthLoginResponse { access_token: string diff --git a/src/lib/config.ts b/src/lib/config.ts deleted file mode 100644 index e58ca965..00000000 --- a/src/lib/config.ts +++ /dev/null @@ -1,4 +0,0 @@ -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 0ae1ffb0..e537c3d7 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 { OAUTH_BASE } from '$lib/config' +import { PUBLIC_SIERO_API_URL } from '$env/static/public' import { getRefreshFromCookies, setAccountCookie, @@ -8,6 +8,8 @@ import { clearAuthCookies } from '$lib/auth/cookies' +const OAUTH_BASE = `${PUBLIC_SIERO_API_URL}/oauth` + type OAuthRefreshResponse = { access_token: string token_type: 'Bearer'