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/index.vue |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/PAMapp/pages/index.vue b/PAMapp/pages/index.vue
index 7a5053b..9640b69 100644
--- a/PAMapp/pages/index.vue
+++ b/PAMapp/pages/index.vue
@@ -45,7 +45,7 @@
 <script lang="ts">
 import { Vue, Component, State, Action } from 'nuxt-property-decorator';
 import { getFavoriteFromStorage, setFavoriteToStorage } from '~/assets/ts/storageConsultant';
-import { addFavoriteConsultant, Consultants } from '~/assets/ts/api/consultant';
+import { addFavoriteConsultant, Consultants, deleteConsultant } from '~/assets/ts/api/consultant';
 import { login, getFavoriteConsultant } from '~/assets/ts/api/consultant';
 import { isLogin } from '~/assets/ts/auth';
 
@@ -84,12 +84,15 @@
     }
 
     removeAgent(agentNo: string) {
-        const findIndex = this.consultantList.findIndex((item, i) => {
-            return item.agentNo === agentNo;
-        })
-        this.consultantList.splice(findIndex, 1);
+
         if (!isLogin()) {
+            const findIndex = this.consultantList.findIndex((item, i) => {
+                return item.agentNo === agentNo;
+            })
+            this.consultantList.splice(findIndex, 1);
             setFavoriteToStorage(this.consultantList)
+        } else {
+            deleteConsultant(agentNo).then(res => this.$router.go(0))
         }
     }
 

--
Gitblit v1.8.0