From 0753a323805d05ba62d6478330a78aee6b47e849 Mon Sep 17 00:00:00 2001
From: HelenHuang <LinHuang@pollex.com.tw>
Date: 星期一, 06 十二月 2021 13:27:10 +0800
Subject: [PATCH] update: sort reviewLog when get data

---
 PAMapp/store/index.ts |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/PAMapp/store/index.ts b/PAMapp/store/index.ts
index 4fe433a..db7b6ef 100644
--- a/PAMapp/store/index.ts
+++ b/PAMapp/store/index.ts
@@ -115,7 +115,14 @@
     @Action
     storeMyAppointmentReviewLog() {
         getMyReviewLog().then((data) => {
-            this.context.commit('updateMyAppointmentReviewLog', data);
+            const dataWithLatestDate = data.map((item) => {
+                return {
+                    ...item,
+                    compareDate: new Date(item.lastModifiedDate)
+                }
+            });
+            const sortedData = dataWithLatestDate.sort((a, b) => +b.compareDate - +a.compareDate);
+            this.context.commit('updateMyAppointmentReviewLog', sortedData);
         });
     }
 

--
Gitblit v1.8.0