server url calculated in constants
This commit is contained in:
cv
2021-05-04 22:15:41 +02:00
parent 56926d2226
commit eb18334fea
3 changed files with 8 additions and 16 deletions
+6 -2
View File
@@ -1,3 +1,7 @@
// TODO: should be defined dynamically?
export const serverURL = 'http://localhost';
export const NODE_PORT = 4001;
const calculateServer = () => {
return window.location.origin.replace(window.location.port, `${NODE_PORT}/`);
};
export const serverURL = calculateServer();
+1 -7
View File
@@ -1,11 +1,5 @@
import axios from 'axios';
import { NODE_PORT } from './apiConstants';
// get origin from URL
const serverURL = window.location.origin.replace(
window.location.port,
`${NODE_PORT}/`
);
import { serverURL } from './apiConstants';
export const eventNamespace = 'event';
export const eventURL = serverURL + eventNamespace;
+1 -7
View File
@@ -1,11 +1,5 @@
import axios from 'axios';
import { NODE_PORT } from '../api/apiConstants';
// get origin from URL
const serverURL = window.location.origin.replace(
window.location.port,
`${NODE_PORT}/`
);
import { serverURL } from '../api/apiConstants';
export const playbackNamespace = 'playback';
const playbackURL = serverURL + playbackNamespace;