Energy management system notification function WEB UI

pull/78/head
tianlinzhong 2021-11-02 16:02:42 +08:00
parent c2004ca4c4
commit 2bade8434f
1 changed files with 7 additions and 4 deletions

View File

@ -62,7 +62,7 @@ const Notification = ({ setRedirect, setRedirectUrl, t }) => {
let isResponseOK = false; let isResponseOK = false;
if (!fetchSuccess) { if (!fetchSuccess) {
fetch(APIBaseURL + '/notifications?' + fetch(APIBaseURL + '/webmessagesnew?' +
'startdatetime=' + startDatetime.format('YYYY-MM-DDTHH:mm:ss') + 'startdatetime=' + startDatetime.format('YYYY-MM-DDTHH:mm:ss') +
'&enddatetime=' + endDatetime.format('YYYY-MM-DDTHH:mm:ss'), { '&enddatetime=' + endDatetime.format('YYYY-MM-DDTHH:mm:ss'), {
method: 'GET', method: 'GET',
@ -90,7 +90,8 @@ const Notification = ({ setRedirect, setRedirectUrl, t }) => {
let notification = {} let notification = {}
notification['id'] = json[index]['id']; notification['id'] = json[index]['id'];
notification['subject'] = json[index]['subject']; 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['message'] = json[index]['message'];
notification['status'] = json[index]['status']; notification['status'] = json[index]['status'];
notification['url'] = json[index]['url']; notification['url'] = json[index]['url'];
@ -250,7 +251,7 @@ const Notification = ({ setRedirect, setRedirectUrl, t }) => {
const handleRead = (id, ) => { const handleRead = (id, ) => {
console.log('Mark As Read: ', id) console.log('Mark As Read: ', id)
let isResponseOK = false; let isResponseOK = false;
fetch(APIBaseURL + '/notifications/' + id, { fetch(APIBaseURL + '/webmessages/' + id, {
method: 'PUT', method: 'PUT',
headers: { headers: {
"Content-type": "application/json", "Content-type": "application/json",
@ -259,7 +260,9 @@ const Notification = ({ setRedirect, setRedirectUrl, t }) => {
}, },
body: JSON.stringify({ body: JSON.stringify({
"data": { "data": {
"status": 'read' "status": '' +
'',
"reply": 'ok'
} }
}), }),
}).then(response => { }).then(response => {