Quellcode durchsuchen

feat: Update SDK config to use domain field

Use window.location.origin as the domain instead of
separate apiHost/apiPort/wsHost/wsPort/secure fields.
Fszontagh vor 4 Monaten
Ursprung
Commit
00a178e5f3
1 geänderte Dateien mit 2 neuen und 11 gelöschten Zeilen
  1. 2 11
      src/config.ts

+ 2 - 11
src/config.ts

@@ -1,17 +1,8 @@
 import type { BaaSClientConfig } from '@picobaas/client';
 
-// When served from the backend's public folder, API is on the same origin
-const isSecure = window.location.protocol === 'https:';
-const defaultPort = isSecure ? 443 : 80;
-const currentPort = window.location.port ? parseInt(window.location.port) : defaultPort;
-
 export const config: BaaSClientConfig = {
-  // Use the same host/port as the current page (backend serves both static files and API)
-  apiHost: window.location.hostname,
-  apiPort: currentPort,
-  wsHost: window.location.hostname,
-  wsPort: currentPort, // WebSocket on same port as API
-  secure: isSecure,
+  // Use the current page origin (backend serves both static files and API)
+  domain: window.location.origin,
   autoRefresh: true,
   storageKey: 'imagedrop_auth',
 };