fix: local dev api/ws urls

This commit is contained in:
Andras Bacsai 2022-11-16 12:40:28 +00:00
parent f54c0b7dff
commit 9b9b6937f4
2 changed files with 2 additions and 2 deletions

View File

@ -11,7 +11,7 @@ export function getAPIUrl() {
return `https://${CODESANDBOX_HOST.replace(/\$PORT/, '3001')}`;
}
return dev
? 'http://localhost:3001'
? `http://${window.location.hostname}:3001`
: 'http://localhost:3000';
}
export function getWebhookUrl(type: string) {

View File

@ -3,7 +3,7 @@ import cuid from 'cuid';
import Cookies from 'js-cookie';
import { writable, readable, type Writable } from 'svelte/store';
import { io as ioClient } from 'socket.io-client';
const socket = ioClient(dev ? 'http://localhost:3001' : '/', { auth: { token: Cookies.get('token') }, autoConnect: false });
const socket = ioClient(dev ? `http://${window.location.hostname}:3001` : '/', { auth: { token: Cookies.get('token') }, autoConnect: false });
export const io = socket;
interface AppSession {