Small tweaks (cors etc)

This commit is contained in:
Igor Katson 2024-08-21 22:27:58 +01:00
parent 1a1d07e5cb
commit 0c9a5093d0
No known key found for this signature in database
GPG key ID: B4EC22B66D61A3F5
5 changed files with 28 additions and 10 deletions

View file

@ -9,10 +9,16 @@ import {
} from "./api-types";
// Define API URL and base path
const apiUrl =
window.origin === "null" || window.origin === "http://localhost:3031"
? "http://localhost:3030"
: "";
const apiUrl = (() => {
if (window.origin === "null" || window.origin === "http://localhost:3031") {
return "http://localhost:3030"
}
let port = /http.*:\/\/.*:(\d+)/.exec(window.origin)?.[1];
if (port == "3031") {
return window.origin.replace("3031", "3030");
}
return "";
})();
const makeRequest = async (
method: string,