From 391d7db141245798c64aa8acb0f143ab4152aa79 Mon Sep 17 00:00:00 2001
From: Mila <Mila@pollex.com.tw>
Date: 星期三, 10 十一月 2021 10:47:46 +0800
Subject: [PATCH] TODO#130015/130016 [推薦保險顧問/我的顧問清單] api 串接

---
 PAMapp/pages/myConsultantList.vue |   21 +++++++++++----------
 1 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/PAMapp/pages/myConsultantList.vue b/PAMapp/pages/myConsultantList.vue
index d85e127..fc6c428 100644
--- a/PAMapp/pages/myConsultantList.vue
+++ b/PAMapp/pages/myConsultantList.vue
@@ -29,14 +29,15 @@
 import { Context } from '@nuxt/types';
 import { Vue, Component, Watch } from 'vue-property-decorator';
 import { Route } from 'vue-router/types/router.d'
-import { Agents } from '~/plugins/api/home';
+import { Consultants, getFavoriteConsultant } from '~/assets/ts/api/consultant';
+import { isLogin } from '~/assets/ts/auth';
 
 @Component
 export default class myConsultantList extends Vue {
     activeTabName = 'consultantList';
-    agents: Agents[] = [];
-    contactedList: Agents[] = [];
-    consultantList: Agents[] = [];
+    agents: Consultants[] = [];
+    contactedList: Consultants[] = [];
+    consultantList: Consultants[] = [];
 
     tabClick(path: string) {
         this.activeTabName = path;
@@ -44,13 +45,13 @@
     }
 
     async asyncData(context: Context) {
-        let agents: Agents[] = [];
-        let contactedList: Agents[] = [];
-        let consultantList: Agents[] = [];
+        let agents: Consultants[] = [];
+        let contactedList: Consultants[] = [];
+        let consultantList: Consultants[] = [];
 
-        await context.$service.home.recommendConsultantList().then((result: Agents[]) => {
-            agents = result;
-        })
+        if (isLogin()) {
+            await getFavoriteConsultant().then((response) => agents = response.data);
+        }
 
         contactedList = agents.filter(item => item.contactStatus === 'contacted');
         consultantList = agents.filter(item => item.contactStatus !== 'contacted');

--
Gitblit v1.8.0