mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-01-07 00:48:24 +01:00
Fallback to relative address if Alternative_IP is misconfigured.
Affects issues: - #2260
This commit is contained in:
parent
6c5c9ce913
commit
030dff7e0a
@ -2,7 +2,13 @@ import axios from "axios";
|
||||
|
||||
const toBeReplaced = "PLAN_BASE_ADDRESS";
|
||||
|
||||
export const baseAddress = toBeReplaced.includes("BASE") ? "" : toBeReplaced;
|
||||
const isCurrentAddress = (address) => {
|
||||
const is = window.location.href.startsWith(address);
|
||||
if (!is) console.warn(`Configured address ${address} did not match start of ${window.location.href}, falling back to relative address. Configure 'Webserver.Alternative_IP' settings to point to your address.`)
|
||||
return is;
|
||||
}
|
||||
|
||||
export const baseAddress = "PLAN_BASE_ADDRESS" === toBeReplaced || !isCurrentAddress(toBeReplaced) ? "" : toBeReplaced;
|
||||
|
||||
export const doSomeGetRequest = async (url, statusOptions) => {
|
||||
let response = undefined;
|
||||
|
Loading…
Reference in New Issue
Block a user