mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59:52 +03:00
eslint
This commit is contained in:
@@ -1,24 +1,24 @@
|
||||
export const PROJECT_NAME = process.env.REACT_APP_PROJECT_NAME!
|
||||
export const PROJECT_PATH = process.env.REACT_APP_PROJECT_PATH!
|
||||
export const PROJECT_NAME = process.env.REACT_APP_PROJECT_NAME!;
|
||||
export const PROJECT_PATH = process.env.REACT_APP_PROJECT_PATH!;
|
||||
|
||||
export const ENDPOINT_ROOT = calculateEndpointRoot('/rest/')
|
||||
export const WEB_SOCKET_ROOT = calculateWebSocketRoot('/ws/')
|
||||
export const ENDPOINT_ROOT = calculateEndpointRoot('/rest/');
|
||||
export const WEB_SOCKET_ROOT = calculateWebSocketRoot('/ws/');
|
||||
|
||||
function calculateEndpointRoot(endpointPath: string) {
|
||||
const httpRoot = process.env.REACT_APP_HTTP_ROOT
|
||||
const httpRoot = process.env.REACT_APP_HTTP_ROOT;
|
||||
if (httpRoot) {
|
||||
return httpRoot + endpointPath
|
||||
return httpRoot + endpointPath;
|
||||
}
|
||||
const location = window.location
|
||||
return location.protocol + '//' + location.host + endpointPath
|
||||
const location = window.location;
|
||||
return location.protocol + '//' + location.host + endpointPath;
|
||||
}
|
||||
|
||||
function calculateWebSocketRoot(webSocketPath: string) {
|
||||
const webSocketRoot = process.env.REACT_APP_WEB_SOCKET_ROOT
|
||||
const webSocketRoot = process.env.REACT_APP_WEB_SOCKET_ROOT;
|
||||
if (webSocketRoot) {
|
||||
return webSocketRoot + webSocketPath
|
||||
return webSocketRoot + webSocketPath;
|
||||
}
|
||||
const location = window.location
|
||||
const webProtocol = location.protocol === 'https:' ? 'wss:' : 'ws:'
|
||||
return webProtocol + '//' + location.host + webSocketPath
|
||||
const location = window.location;
|
||||
const webProtocol = location.protocol === 'https:' ? 'wss:' : 'ws:';
|
||||
return webProtocol + '//' + location.host + webSocketPath;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user