From 2bade8434f4cd44562e1766e3cb05a6aa2bd41c9 Mon Sep 17 00:00:00 2001 From: tianlinzhong <673359306@qq.com> Date: Tue, 2 Nov 2021 16:02:42 +0800 Subject: [PATCH] Energy management system notification function WEB UI --- web/src/components/MyEMS/Notification/Notification.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/web/src/components/MyEMS/Notification/Notification.js b/web/src/components/MyEMS/Notification/Notification.js index 50af1e93..cc4c4c1f 100644 --- a/web/src/components/MyEMS/Notification/Notification.js +++ b/web/src/components/MyEMS/Notification/Notification.js @@ -62,7 +62,7 @@ const Notification = ({ setRedirect, setRedirectUrl, t }) => { let isResponseOK = false; if (!fetchSuccess) { - fetch(APIBaseURL + '/notifications?' + + fetch(APIBaseURL + '/webmessagesnew?' + 'startdatetime=' + startDatetime.format('YYYY-MM-DDTHH:mm:ss') + '&enddatetime=' + endDatetime.format('YYYY-MM-DDTHH:mm:ss'), { method: 'GET', @@ -90,7 +90,8 @@ const Notification = ({ setRedirect, setRedirectUrl, t }) => { let notification = {} notification['id'] = json[index]['id']; notification['subject'] = json[index]['subject']; - notification['created_datetime'] = json[index]['created_datetime']; + notification['created_datetime'] = moment(parseInt(json[index]['created_datetime'])) + .format("YYYY-MM-DD HH:mm:ss"); notification['message'] = json[index]['message']; notification['status'] = json[index]['status']; notification['url'] = json[index]['url']; @@ -250,7 +251,7 @@ const Notification = ({ setRedirect, setRedirectUrl, t }) => { const handleRead = (id, ) => { console.log('Mark As Read: ', id) let isResponseOK = false; - fetch(APIBaseURL + '/notifications/' + id, { + fetch(APIBaseURL + '/webmessages/' + id, { method: 'PUT', headers: { "Content-type": "application/json", @@ -259,7 +260,9 @@ const Notification = ({ setRedirect, setRedirectUrl, t }) => { }, body: JSON.stringify({ "data": { - "status": 'read' + "status": '' + + '', + "reply": 'ok' } }), }).then(response => {