保誠-保戶業務員媒合平台
Tomas
2023-07-15 2f86b5f0c3ad47494886c5794542239bfa26850c
PAMapp/shared/services/httpClient.ts
@@ -6,14 +6,16 @@
const notRequireInterceptorErrorUrl = [
  '/otp/verify',
  // '/otp/sendOtp',
  '/eService/authenticate',
  '/login/validate/get_img_code',
  '/login/validate/verify_img_code',
  '/api/access_analysis/insert'
];
export const http = axios.create({
  baseURL: process.env.BASE_URL,
  withCredentials: true
  withCredentials: true,
});
let apiNumber = 0;
@@ -47,7 +49,8 @@
function addHttpHeader(config: AxiosRequestConfig): void {
  config.headers = {
    Authorization: 'Bearer ' + localStorage.getItem('id_token')
    Authorization: 'Bearer ' + localStorage.getItem('id_token'),
    'content-type': 'application/json'
  }
}
@@ -65,6 +68,12 @@
function showErrorMessageBox(error: any): void {
  setTimeout(() => {
    // NOTE: 此為 HOT FIX 顧問登入失敗後,會出現逾時的 dialog [Tomas, 2022/7/20 14:21]
    if(error.config.url.includes('/eService/authenticate')) return;
    if (error.config.url.includes('/otp/sendOtp')) {
      messageBoxService.showErrorMessage('', error);
      return
    }
    if (!_.includes(notRequireInterceptorErrorUrl, error.config.url)) {
      switch (error.response.status) {
        case 401: