封装请求方法

This commit is contained in:
龚皓 2024-07-26 15:58:11 +08:00
parent 7b5bb1aea7
commit f1d2740689
1 changed files with 3 additions and 1 deletions

View File

@ -6,12 +6,13 @@ export const getSuperboxApiConfig = (address) => {
const LOGIN_ROUTE = BASE_ROUTE + "/auth/login"; const LOGIN_ROUTE = BASE_ROUTE + "/auth/login";
const LOGOUT_ROUTE = BASE_ROUTE + "/auth/logout"; const LOGOUT_ROUTE = BASE_ROUTE + "/auth/logout";
const CAMERA_ROUTE = BASE_ROUTE + "/camera/cameras"; const CAMERA_ROUTE = BASE_ROUTE + "/camera/cameras";
const EVENTS_ROUTE = BASE_ROUTE + "/event/events"; const EVENTS_ROUTE = BASE_ROUTE + "/event/events?limit=300";
const ALGORITHM_ROUTE = BASE_ROUTE + "/algorithms"; const ALGORITHM_ROUTE = BASE_ROUTE + "/algorithms";
let addr = address; let addr = address;
if (!addr) { if (!addr) {
addr = window.location.host.replace(/:\d+/, ""); addr = window.location.host.replace(/:\d+/, "");
console.log("No address provided, using " + addr);
} }
const superboxAddress = "http://" + addr + ":" + PORT.toString(); const superboxAddress = "http://" + addr + ":" + PORT.toString();
@ -155,4 +156,5 @@ export default {
getSuperboxApiConfig, getSuperboxApiConfig,
initCodeNameMap, initCodeNameMap,
codenameTranslate, codenameTranslate,
getAlgorithms,
}; };