mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-16 13:22:18 +02:00
Changed How is local is checked and how serverURL is build to prevent errros in offline mode
This commit is contained in:
parent
6dc10f549f
commit
cc9c4dcaf1
@ -215,8 +215,13 @@ export function executeIf<T>(condition: boolean, promiseFunc: () => Promise<T>):
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const sessionIdKey = 'pokerogue_sessionId';
|
export const sessionIdKey = 'pokerogue_sessionId';
|
||||||
export const isLocal = window.location.hostname === 'localhost' || window.location.hostname === '';
|
// Check if the current hostname is 'localhost' or an IP address, and ensure a port is specified
|
||||||
export const serverUrl = isLocal ? 'http://localhost:8001' : '';
|
export const isLocal = (window.location.hostname === 'localhost' ||
|
||||||
|
/^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$/.test(window.location.hostname)) &&
|
||||||
|
window.location.port !== '';
|
||||||
|
|
||||||
|
// Set the server URL based on whether it's local or not
|
||||||
|
export const serverUrl = isLocal ? `${window.location.hostname}:${window.location.port}` : '';
|
||||||
export const apiUrl = isLocal ? serverUrl : 'https://api.pokerogue.net';
|
export const apiUrl = isLocal ? serverUrl : 'https://api.pokerogue.net';
|
||||||
|
|
||||||
export function setCookie(cName: string, cValue: string): void {
|
export function setCookie(cName: string, cValue: string): void {
|
||||||
|
Loading…
Reference in New Issue
Block a user