保誠-保戶業務員媒合平台
Tomas
2021-11-18 091f4ed871c30160a97feccdfe32005b3a4fcbc7
PAMapp/assets/ts/api/share.ts
@@ -1,18 +1,29 @@
import axios from 'axios';
import { AxiosRequestConfig, AxiosError, AxiosResponse } from 'axios';
import { AxiosRequestConfig, AxiosError, AxiosResponse } from 'axios';
export const service = axios.create({
    baseURL: process.env.BASE_URL
})
service.interceptors.request.use(function (config: AxiosRequestConfig) {
    loadingStart;
    return config;
}, function (error: AxiosError) {
    loadingFinish;
    return Promise.reject(error);
});
service.interceptors.response.use(function (response: AxiosResponse) {
    loadingFinish;
    return response;
}, function (error: AxiosError) {
    loadingFinish;
    return Promise.reject(error);
});
});
function loadingStart():void{
    window.$nuxt.$loading.start();
}
function loadingFinish():void{
    window.$nuxt.$loading.finish();
}