diff --git a/web/src/lib/auth-api.ts b/web/src/lib/auth-api.ts index 6ed518f..331111b 100644 --- a/web/src/lib/auth-api.ts +++ b/web/src/lib/auth-api.ts @@ -10,7 +10,7 @@ import { createAuthClient, type AuthClient } from '@bytelyst/auth-client'; export const PRODUCT_ID = 'chronomind'; -function getBaseUrl(): string { +export function getBaseUrl(): string { if (typeof window !== 'undefined' && (window as unknown as Record).__PLATFORM_URL__) { return (window as unknown as Record).__PLATFORM_URL__ as string; } diff --git a/web/src/lib/auth-context.tsx b/web/src/lib/auth-context.tsx index e9d6a00..25b1d8d 100644 --- a/web/src/lib/auth-context.tsx +++ b/web/src/lib/auth-context.tsx @@ -6,7 +6,7 @@ import { createAuthProvider } from '@bytelyst/react-auth'; import { setSyncEnabled } from './platform-sync'; -import { PRODUCT_ID, getAuthClient } from './auth-api'; +import { PRODUCT_ID, getAuthClient, getBaseUrl } from './auth-api'; interface ChronoMindUser { id: string; @@ -18,13 +18,6 @@ interface ChronoMindUser { [key: string]: unknown; } -function getBaseUrl(): string { - if (typeof window !== 'undefined' && (window as unknown as Record).__PLATFORM_URL__) { - return (window as unknown as Record).__PLATFORM_URL__ as string; - } - return process.env.NEXT_PUBLIC_PLATFORM_SERVICE_URL ?? 'https://api.chronomind.app'; -} - const { AuthProvider: _AuthProvider, useAuth: _useAuth } = createAuthProvider({ baseUrl: getBaseUrl(), storagePrefix: 'chronomind',