fix path bug

This commit is contained in:
lxsang 2020-11-19 21:35:49 +01:00
parent 43f96af920
commit 9d5a0b404c
2 changed files with 8 additions and 2 deletions

Binary file not shown.

View File

@ -123,10 +123,16 @@ namespace OS {
*/ */
export var HOST: string = export var HOST: string =
loc.hostname + (loc.port ? `:${loc.port}` : ""); loc.hostname + (loc.port ? `:${loc.port}` : "");
/**
* The base URI of the server-side API
*/
export var BASE_URI: string = `${HOST}${loc.pathname}`;
/** /**
* The base REST URI of the server-side API * The base REST URI of the server-side API
*/ */
export var REST: string = `${loc.protocol}//${HOST}${loc.pathname}`; export var REST: string = `${loc.protocol}//${BASE_URI}`;
/** /**
* The namespace `handle` contains some low level API to * The namespace `handle` contains some low level API to
@ -344,7 +350,7 @@ namespace OS {
if (ws) { if (ws) {
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
try { try {
const path = `${API.HOST}/system/apigateway?ws=1`; const path = `${API.BASE_URI}/system/apigateway?ws=1`;
const proto = const proto =
window.location.protocol === "https:" window.location.protocol === "https:"
? "wss://" ? "wss://"