Archived
forked from admin/userbase
44 lines
1.2 KiB
TypeScript
44 lines
1.2 KiB
TypeScript
import config from "./host.config";
|
|
import { AxiosRequestConfig } from "axios";
|
|
import { PcDebugUser } from "@/types/Basics";
|
|
|
|
const serviceUrl = config.isMock ? "" : config.serviceHost,
|
|
timeout: number = 15000;
|
|
|
|
let baseConfig: AxiosRequestConfig = {
|
|
baseURL: serviceUrl + "/",
|
|
headers: {
|
|
// "Content-Type": "application/x-www-form-urlencoded",
|
|
"Content-Type": "application/json;charset=urf-8",
|
|
bschapirequest: "1",
|
|
"Access-Control-Allow-Headers": "Set-Cookie",
|
|
"X-Requested-With": "XMLHttpRequest",
|
|
},
|
|
params: {},
|
|
data: {},
|
|
timeout, // 接口超时限制(ms)
|
|
withCredentials: true,
|
|
responseType: "json",
|
|
// transformRequest: [
|
|
// function (data) {
|
|
// if (typeof data == "string") return data;
|
|
// let ret = "";
|
|
// for (let it in data) {
|
|
// ret += encodeURIComponent(it) + "=" + encodeURIComponent(data[it]) + "&";
|
|
// }
|
|
// return ret;
|
|
// },
|
|
// ],
|
|
// maxContentLength: 2000,
|
|
validateStatus(status) {
|
|
return status >= 200 && status < 300; // default
|
|
},
|
|
};
|
|
|
|
let debugUser: PcDebugUser = {
|
|
DebugUser: "zhd",
|
|
AppType: "ChildOptCourse",
|
|
};
|
|
|
|
export { baseConfig, debugUser };
|