保誠-保戶業務員媒合平台
Tomas
2023-09-01 1e8fb5971367812c11bb237637efbf36da7b0c9c
Update: P12.1 URL manipulation
修改1個檔案
15 ■■■■ 已變更過的檔案
PAMapp/shared/services/httpClient.ts 15 ●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
PAMapp/shared/services/httpClient.ts
@@ -13,11 +13,20 @@
  '/api/access_analysis/insert'
];
const BASE_URL = process.env.BASE_URL;
const BASE_URL = process.env.BASE_URL!;
function sanitizeBaseUrl(baseUrl: string): string {
  const isValidBaseUrl = (url: string) => url.includes('api');
  if (isValidBaseUrl(baseUrl)) {
    return baseUrl;
  } else {
    throw new Error('Invalid BASE_URL');
  }
}
export const http = axios.create({
  baseURL: BASE_URL,
  withCredentials: true,
  baseURL: sanitizeBaseUrl(BASE_URL),
  withCredentials: true
});
let apiNumber = 0;