本地测试
This commit is contained in:
parent
617684677d
commit
bb0a31f601
Binary file not shown.
|
Before Width: | Height: | Size: 2.5 MiB After Width: | Height: | Size: 2.5 MiB |
@ -1,6 +1,7 @@
|
|||||||
const query = readURLParams();
|
const query = readURLParams();
|
||||||
const storedAppId = window.localStorage.getItem("mifa-pay-application-id") || "";
|
const storedAppId = window.localStorage.getItem("mifa-pay-application-id") || "";
|
||||||
const API_BASE_URL = "https://jvapi.haiyihy.com";
|
const API_BASE_URL = "https://jvapi.haiyihy.com";
|
||||||
|
const LOCAL_API_BASE_URL = "http://127.0.0.1:1100";
|
||||||
const LOGO_SRC = "./mifapay-logo.png";
|
const LOGO_SRC = "./mifapay-logo.png";
|
||||||
|
|
||||||
function readURLParams() {
|
function readURLParams() {
|
||||||
@ -106,6 +107,20 @@ function readRawParam(name) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function apiBaseURL() {
|
function apiBaseURL() {
|
||||||
|
const useProdApi = query.get("prod") === "true";
|
||||||
|
const isLocalPage =
|
||||||
|
window.location.protocol === "http:" &&
|
||||||
|
["localhost", "127.0.0.1", "0.0.0.0", "::1", "[::1]"].includes(
|
||||||
|
window.location.hostname
|
||||||
|
);
|
||||||
|
if (isLocalPage && !useProdApi) {
|
||||||
|
return LOCAL_API_BASE_URL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (useProdApi) {
|
||||||
|
return API_BASE_URL;
|
||||||
|
}
|
||||||
|
|
||||||
const override = window.MIFAPAY_API_BASE_URL || query.get("apiBase");
|
const override = window.MIFAPAY_API_BASE_URL || query.get("apiBase");
|
||||||
return String(override || API_BASE_URL).replace(/\/+$/, "");
|
return String(override || API_BASE_URL).replace(/\/+$/, "");
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user