|
@@ -21,7 +21,6 @@ function isConfig(x?: string | AxiosRequestConfig): x is AxiosRequestConfig {
|
|
return typeof x === 'object'
|
|
return typeof x === 'object'
|
|
}
|
|
}
|
|
const needLoadingApiList: any[] = [
|
|
const needLoadingApiList: any[] = [
|
|
- '/api/statistic/monitor/list',
|
|
|
|
'/api/statistic/monitor/list',
|
|
'/api/statistic/monitor/list',
|
|
'/api/statistic/monitor/list/by/group',
|
|
'/api/statistic/monitor/list/by/group',
|
|
'/api/statistic/marker/compare/list',
|
|
'/api/statistic/marker/compare/list',
|
|
@@ -56,10 +55,9 @@ function useFetch<K extends ApiKeys>(k: K, ...args: any[]) {
|
|
|
|
|
|
const fetch = async (data?: ExtractApiParams<K>, fetchConfig: AxiosRequestConfig = {}) => {
|
|
const fetch = async (data?: ExtractApiParams<K>, fetchConfig: AxiosRequestConfig = {}) => {
|
|
const mainStore = useMainStore()
|
|
const mainStore = useMainStore()
|
|
-
|
|
|
|
|
|
+ const apiConfig = api[k]
|
|
|
|
+ const apiConfigUrl = typeof apiConfig === 'string' ? apiConfig : apiConfig?.url
|
|
try {
|
|
try {
|
|
- const apiConfig = api[k]
|
|
|
|
- console.log('apiConfig:', apiConfig)
|
|
|
|
if (unref(loading)) {
|
|
if (unref(loading)) {
|
|
cancel()
|
|
cancel()
|
|
}
|
|
}
|
|
@@ -67,7 +65,7 @@ function useFetch<K extends ApiKeys>(k: K, ...args: any[]) {
|
|
abortcontroller = new AbortController()
|
|
abortcontroller = new AbortController()
|
|
|
|
|
|
loading.value = true
|
|
loading.value = true
|
|
- if (needLoadingApiList.indexOf(apiConfig) > -1) {
|
|
|
|
|
|
+ if (needLoadingApiList.indexOf(apiConfigUrl) > -1) {
|
|
mainStore.setGlobalLoading(true)
|
|
mainStore.setGlobalLoading(true)
|
|
}
|
|
}
|
|
// const apiConfig = api[k]
|
|
// const apiConfig = api[k]
|
|
@@ -91,7 +89,9 @@ function useFetch<K extends ApiKeys>(k: K, ...args: any[]) {
|
|
return Promise.reject(failed)
|
|
return Promise.reject(failed)
|
|
} finally {
|
|
} finally {
|
|
loading.value = false
|
|
loading.value = false
|
|
- mainStore.setGlobalLoading(false)
|
|
|
|
|
|
+ if (needLoadingApiList.indexOf(apiConfigUrl) > -1) {
|
|
|
|
+ mainStore.setGlobalLoading(false)
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|