diff --git a/v1-com-officielle/src/data/msgData.js b/v1-com-officielle/src/data/msgData.js index 145523e..cc11a69 100644 --- a/v1-com-officielle/src/data/msgData.js +++ b/v1-com-officielle/src/data/msgData.js @@ -38,6 +38,7 @@ export async function loadMsgData() { let entry = { title: textInfos.title, date: dateInfos.date, + dateInfo: pouet.created_at, content: textInfos.content, like: pouet.favourites_count, isLiked: false, diff --git a/v1-com-officielle/src/dataExchange.js b/v1-com-officielle/src/dataExchange.js index 5c41a27..da5fd74 100644 --- a/v1-com-officielle/src/dataExchange.js +++ b/v1-com-officielle/src/dataExchange.js @@ -4,6 +4,7 @@ export const dataStorage = reactive({ selectedMsg: { title: '', date: '', + dateInfo: '', content: '', like: 0, isLiked: false, diff --git a/v1-com-officielle/src/infoComponents/InboxContent.vue b/v1-com-officielle/src/infoComponents/InboxContent.vue index 7b2fb4b..2ed81fc 100644 --- a/v1-com-officielle/src/infoComponents/InboxContent.vue +++ b/v1-com-officielle/src/infoComponents/InboxContent.vue @@ -243,6 +243,9 @@ if (!this.msgList[j].wasRead) this.msgNumber += 1; } + }, + organizeItems(){ + this.msgList.sort((a,b) => b.dateInfo.localeCompare(a.dateInfo)); } }, data(){ @@ -262,6 +265,7 @@ }, async mounted(){ this.msgList = await loadMsgData(); + this.organizeItems(); //console.log(this.msgList); this.msgNumber = this.msgList.length console.log("Inbox content is loaded!");