uni-halo/common/http/index.js

39 lines
758 B
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* 功能:请求工具
* 作者:小莫唐尼
* 邮箱studio@925i.cn
* 时间2022年07月21日 18:58:03
* 版本v0.1.0
* 修改记录:
* 修改内容:
* 修改人员:
* 修改时间:
*/
import HaloTokenConfig from '@/config/token.config.js'
import {
setInterceptors
} from "./interceptors.js";
import Request from "@/js_sdk/luch-request/luch-request";
const http = new Request()
/* 设置全局配置 */
http.setConfig((config) => {
// 如果是在外部浏览器调试或者编译为h5请注释该行代码
config.baseURL = HaloTokenConfig.BASE_API;
config.header = {
...config.header,
ContentType: 'application/json',
dataType: 'json'
}
return config
})
setInterceptors(http)
export {
http
}