From 509d17e9885c46af9331666a43eb8766ec72c295 Mon Sep 17 00:00:00 2001
From: jack <jack.su@pollex.com.tw>
Date: 星期二, 19 九月 2023 12:11:57 +0800
Subject: [PATCH] Merge branch '滲透' of ssh://dev.pollex.com.tw:29418/pcalife/PAM into 滲透

---
 PAMapp/pages/questionnaire/_agentNo.vue |    6 +++---
 PAMapp/shared/services/httpClient.ts    |   27 +++++++++++----------------
 2 files changed, 14 insertions(+), 19 deletions(-)

diff --git a/PAMapp/pages/questionnaire/_agentNo.vue b/PAMapp/pages/questionnaire/_agentNo.vue
index 7e7c52e..9208efb 100644
--- a/PAMapp/pages/questionnaire/_agentNo.vue
+++ b/PAMapp/pages/questionnaire/_agentNo.vue
@@ -453,9 +453,7 @@
     ////////////////////////////////////////////////////////////////////////////
 
     async sentDemand() {
-      if (typeof this.isEditBtn !== 'undefined' && this.isEditBtn) {
-        await this.editAppointmentDemand();
-      } else {
+      if (!this.isEditBtn) {
         // 雿輻 async/await 靘��甇交����蝯��
         const addFavoriteAgentList = [{ agentNo: this.$route.params.agentNo, createdTime: new Date().toISOString() }];
         const response = await queryConsultantService.addFavoriteConsultant(addFavoriteAgentList);
@@ -472,6 +470,8 @@
             throw new Error('this.editAppointmentDemand is not defined or not a function.');
           }
         }
+      } else {
+        await this.editAppointmentDemand();
       }
 
       const editSettingInfo: UserSetting = {
diff --git a/PAMapp/shared/services/httpClient.ts b/PAMapp/shared/services/httpClient.ts
index db17491..08a5b6e 100644
--- a/PAMapp/shared/services/httpClient.ts
+++ b/PAMapp/shared/services/httpClient.ts
@@ -13,25 +13,20 @@
   '/api/access_analysis/insert'
 ];
 
-const BASE_URL = process.env.BASE_URL!;
-
-function sanitizeBaseUrl(baseUrl: string): string {
-  const pattern = /^(https?:\/\/).+/i;
-  if (!pattern.test(baseUrl)) {
-    throw new Error('Invalid BASE_URL');
+function getBaseUrl(): string {
+  const baseUrl = process.env.BASE_URL;
+  if (!baseUrl) {
+    throw new Error('BASE_URL is not defined in process.env');
   }
-  const cleanedBaseUrl = cleanUrl(baseUrl);
-  return cleanedBaseUrl;
+  // const pattern = /^(https?:\/\/)[\w.-]+(:\d+)?/i; // �����RL撽��
+  // if (!pattern.test(baseUrl)) {
+  //   throw new Error('Invalid BASE_URL');
+  // }
+  // 銝�閬���RL嚗�摰歇蝬蝯�RL
+  return baseUrl;
 }
-
-function cleanUrl(url: string): string {
-  const cleanedUrl = url.replace(/[^a-zA-Z0-9:/._-]/g, '');
-  return cleanedUrl;
-}
-
-
 export const http = axios.create({
-  baseURL: sanitizeBaseUrl(BASE_URL),
+  baseURL: getBaseUrl(), // 雿輻�������aseURL
   withCredentials: true
 });
 

--
Gitblit v1.8.0