Built the Sentinel Tab
This commit is contained in:
19
app/src/lib/api.ts
Normal file
19
app/src/lib/api.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
const rawApiBase = import.meta.env.VITE_API_URL?.trim();
|
||||
const DEPLOYED_BACKEND_ORIGIN = 'https://54.152.236.10';
|
||||
|
||||
function getBrowserOrigin() {
|
||||
if (typeof window !== 'undefined' && window.location?.origin) {
|
||||
return window.location.origin;
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
export const API_URL = (
|
||||
rawApiBase && rawApiBase.length > 0
|
||||
? rawApiBase
|
||||
: import.meta.env.DEV
|
||||
? getBrowserOrigin()
|
||||
: DEPLOYED_BACKEND_ORIGIN || getBrowserOrigin()
|
||||
).replace(/\/$/, '');
|
||||
|
||||
export const WS_URL = API_URL.replace(/^http/, 'ws');
|
||||
Reference in New Issue
Block a user