From a8e5dcd396b2934e0abdd97e2241bd020afe569b Mon Sep 17 00:00:00 2001
From: Mila <Mila@pollex.com.tw>
Date: 星期四, 11 十一月 2021 14:49:23 +0800
Subject: [PATCH] TODO#130018 [加入顧問] API 串接

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

diff --git a/PAMapp/pages/myConsultantList.vue b/PAMapp/pages/myConsultantList.vue
index fc6c428..81b6e3a 100644
--- a/PAMapp/pages/myConsultantList.vue
+++ b/PAMapp/pages/myConsultantList.vue
@@ -29,6 +29,7 @@
 import { Context } from '@nuxt/types';
 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 { isLogin } from '~/assets/ts/auth';
 
@@ -51,6 +52,8 @@
 
         if (isLogin()) {
             await getFavoriteConsultant().then((response) => agents = response.data);
+        } else {
+            agents = getFavoriteFromStorage();
         }
 
         contactedList = agents.filter(item => item.contactStatus === 'contacted');
@@ -63,9 +66,12 @@
         }
     }
 
-    removeAgent(agentNo: number) {
+    removeAgent(agentNo: string) {
         const fintIndex = this.consultantList.findIndex(item => item.agentNo === agentNo);
         this.consultantList.splice(fintIndex, 1);
+        if (!isLogin()) {
+            setFavoriteToStorage(this.consultantList);
+        }
     }
 
     @Watch('$route') watchRouter(currentRoute: Route) {

--
Gitblit v1.8.0