From e828225de7636d0195db2c3c9b1701a5b2f12049 Mon Sep 17 00:00:00 2001
From: Tomas <tomasysh@gmail.com>
Date: 星期四, 14 九月 2023 18:01:33 +0800
Subject: [PATCH] Merge branch '滲透' of https://dev.pollex.com.tw:8443/r/pcalife/PAM into 滲透

---
 PAMapp/shared/services/httpClient.ts |   21 +++++++++++++++++----
 1 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/PAMapp/shared/services/httpClient.ts b/PAMapp/shared/services/httpClient.ts
index e704513..08a5b6e 100644
--- a/PAMapp/shared/services/httpClient.ts
+++ b/PAMapp/shared/services/httpClient.ts
@@ -10,10 +10,23 @@
   '/eService/authenticate',
   '/login/validate/get_img_code',
   '/login/validate/verify_img_code',
+  '/api/access_analysis/insert'
 ];
 
+function getBaseUrl(): string {
+  const baseUrl = process.env.BASE_URL;
+  if (!baseUrl) {
+    throw new Error('BASE_URL is not defined in process.env');
+  }
+  // const pattern = /^(https?:\/\/)[\w.-]+(:\d+)?/i; // �����RL撽��
+  // if (!pattern.test(baseUrl)) {
+  //   throw new Error('Invalid BASE_URL');
+  // }
+  // 銝�閬���RL嚗�摰歇蝬蝯�RL
+  return baseUrl;
+}
 export const http = axios.create({
-  baseURL: process.env.BASE_URL,
+  baseURL: getBaseUrl(), // 雿輻�������aseURL
   withCredentials: true
 });
 
@@ -48,7 +61,8 @@
 
 function addHttpHeader(config: AxiosRequestConfig): void {
   config.headers = {
-    Authorization: 'Bearer ' + localStorage.getItem('id_token')
+    Authorization: 'Bearer ' + localStorage.getItem('id_token'),
+    'content-type': 'application/json'
   }
 }
 
@@ -66,9 +80,8 @@
 
 function showErrorMessageBox(error: any): void {
   setTimeout(() => {
-    console.log('errorerrorerror', error.config);
     // NOTE: 甇斤 HOT FIX 憿批��憭望������暹��� dialog [Tomas, 2022/7/20 14:21]
-    if(error.config.url.includes('api/eService/authenticate')) return;
+    if(error.config.url.includes('/eService/authenticate')) return;
     if (error.config.url.includes('/otp/sendOtp')) {
       messageBoxService.showErrorMessage('', error);
       return

--
Gitblit v1.8.0