mirror of
https://github.com/zclzone/vue-naive-admin.git
synced 2025-04-30 14:19:01 +08:00
19 lines
591 B
JavaScript
19 lines
591 B
JavaScript
import axios from 'axios'
|
|
import { setupInterceptor } from './interceptors'
|
|
|
|
function createAxios(option = {}) {
|
|
const defBaseURL = window.__APP__GLOB__CONF__?.VITE_APP_GLOB_BASE_API || import.meta.env.VITE_APP_GLOB_BASE_API
|
|
const service = axios.create({
|
|
timeout: option.timeout || 120000,
|
|
baseURL: option.baseURL || defBaseURL,
|
|
})
|
|
setupInterceptor(service)
|
|
return service
|
|
}
|
|
|
|
export const defAxios = createAxios()
|
|
|
|
export const mockAxios = createAxios({
|
|
baseURL: window.__APP__GLOB__CONF__?.VITE_APP_GLOB_BASE_API_TEST || import.meta.env.VITE_APP_GLOB_BASE_API_TEST,
|
|
})
|