From 8956474e0072133a8650e4a23bcd6b2a3235688a Mon Sep 17 00:00:00 2001
From: Mila <Mila@pollex.com.tw>
Date: 星期一, 15 十一月 2021 18:21:05 +0800
Subject: [PATCH] update: TOOD#130022 我的顧問清單: 串接移除顧問 API

---
 PAMapp/pages/myConsultantList.vue |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/PAMapp/pages/myConsultantList.vue b/PAMapp/pages/myConsultantList.vue
index 81b6e3a..b2f2bb9 100644
--- a/PAMapp/pages/myConsultantList.vue
+++ b/PAMapp/pages/myConsultantList.vue
@@ -30,7 +30,7 @@
 import { Vue, Component, Watch } from 'vue-property-decorator';
 import { Route } from 'vue-router/types/router.d'
 import { getFavoriteFromStorage, setFavoriteToStorage } from '~/assets/ts/storageConsultant';
-import { Consultants, getFavoriteConsultant } from '~/assets/ts/api/consultant';
+import { Consultants, deleteConsultant, getFavoriteConsultant } from '~/assets/ts/api/consultant';
 import { isLogin } from '~/assets/ts/auth';
 
 @Component
@@ -67,10 +67,12 @@
     }
 
     removeAgent(agentNo: string) {
-        const fintIndex = this.consultantList.findIndex(item => item.agentNo === agentNo);
-        this.consultantList.splice(fintIndex, 1);
         if (!isLogin()) {
+            const fintIndex = this.consultantList.findIndex(item => item.agentNo === agentNo);
+            this.consultantList.splice(fintIndex, 1);
             setFavoriteToStorage(this.consultantList);
+        } else {
+            deleteConsultant(agentNo).then(res => this.$router.go(0))
         }
     }
 

--
Gitblit v1.8.0