mirror of
https://gitee.com/durcframework/SOP.git
synced 2025-08-11 21:57:56 +08:00
5.0
This commit is contained in:
@@ -14,6 +14,24 @@ import NProgress from "../progress";
|
||||
import { getToken, formatToken } from "@/utils/auth";
|
||||
import { useUserStoreHook } from "@/store/modules/user";
|
||||
|
||||
export const baseUrl = (url: string) => {
|
||||
if (!url) {
|
||||
throw new Error("url不能为空");
|
||||
}
|
||||
if (url.startsWith("/")) {
|
||||
url = url.substring(1);
|
||||
}
|
||||
return `/api/${url}`;
|
||||
};
|
||||
|
||||
export const createUrl = (data: object) => {
|
||||
const ret = {};
|
||||
for (const dataKey in data) {
|
||||
ret[dataKey] = baseUrl(data[dataKey]);
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
|
||||
// 相关配置请参考:www.axios-js.com/zh-cn/docs/#axios-request-config-1
|
||||
const defaultConfig: AxiosRequestConfig = {
|
||||
// 请求超时时间
|
||||
|
Reference in New Issue
Block a user