refactor(https): 切换基础URL并清理请求拦截器注释
移除生产环境URL注释并启用本地开发URL 清理请求拦截器中不必要的注释和空行
This commit is contained in:
@@ -5,8 +5,8 @@ import { useUserStore } from '@/stores/user'
|
||||
|
||||
// 创建axios实例
|
||||
const service = axios.create({
|
||||
baseURL: 'https://mldash.nycjy.cn/' || '', // API基础路径,支持完整URL
|
||||
// baseURL: 'http://192.168.15.121:8890' || '', // API基础路径,支持完整URL
|
||||
// baseURL: 'https://mldash.nycjy.cn/' || '', // API基础路径,支持完整URL
|
||||
baseURL: 'http://192.168.15.121:8890' || '', // API基础路径,支持完整URL
|
||||
timeout: 100000, // 请求超时时间
|
||||
headers: {
|
||||
'Content-Type': 'application/json;charset=UTF-8'
|
||||
@@ -16,9 +16,6 @@ const service = axios.create({
|
||||
// 请求拦截器
|
||||
service.interceptors.request.use(
|
||||
config => {
|
||||
// 在发送请求之前做些什么
|
||||
// console.log('发送请求:', config)
|
||||
|
||||
// 添加token到请求头
|
||||
const userStore = useUserStore()
|
||||
const token = userStore.token
|
||||
@@ -32,13 +29,10 @@ service.interceptors.request.use(
|
||||
_t: Date.now()
|
||||
}
|
||||
}
|
||||
// https://mldash.nycjy.cn/login
|
||||
// 显示加载状态
|
||||
if (config.showLoading !== false) {
|
||||
// 可以在这里添加全局loading
|
||||
console.log('显示加载中...')
|
||||
}
|
||||
|
||||
return config
|
||||
},
|
||||
error => {
|
||||
@@ -48,7 +42,6 @@ service.interceptors.request.use(
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
|
||||
// 响应拦截器
|
||||
service.interceptors.response.use(
|
||||
response => {
|
||||
|
||||
Reference in New Issue
Block a user