added Mark All As Read action to notification

pull/122/MERGE
13621160019@163.com 2022-02-17 18:55:31 +08:00
parent 93f9641d8b
commit 8ac293d4b3
1 changed files with 8 additions and 8 deletions

View File

@ -42,7 +42,7 @@ const NotificationDropdown = ({ t }) => {
}).then(json => { }).then(json => {
console.log(json) console.log(json)
if (isResponseOK) { if (isResponseOK) {
let NewnotificationList = [] let NewNotificationList = []
if (json.length > 0) { if (json.length > 0) {
json.forEach((currentValue, index) => { json.forEach((currentValue, index) => {
let notification = {} let notification = {}
@ -52,19 +52,19 @@ const NotificationDropdown = ({ t }) => {
notification['message'] = json[index]['message']; notification['message'] = json[index]['message'];
notification['created_datetime'] = moment(parseInt(json[index]['created_datetime'])) notification['created_datetime'] = moment(parseInt(json[index]['created_datetime']))
.format("YYYY-MM-DD HH:mm:ss"); .format("YYYY-MM-DD HH:mm:ss");
if (NewnotificationList.length > 3 ){ if (NewNotificationList.length > 3 ){
return true return true
} }
if (notification['message'].length > 40){ if (notification['message'].length > 40){
notification['message'] = notification['message'].substring(0,30) + "..."; notification['message'] = notification['message'].substring(0,30) + "...";
} }
if (notification["status"] === "new"){ if (notification["status"] === "new"){
NewnotificationList.push(notification); NewNotificationList.push(notification);
} }
}); });
} }
setRawNewNotificationschild(NewnotificationList); setRawNewNotificationschild(NewNotificationList);
} }
}).catch(err => { }).catch(err => {
console.log(err); console.log(err);
@ -126,7 +126,7 @@ const NotificationDropdown = ({ t }) => {
}).then(json => { }).then(json => {
console.log(json) console.log(json)
if (isResponseOK) { if (isResponseOK) {
let NewnotificationList = [] let NewNotificationList = []
if (json.length > 0) { if (json.length > 0) {
json.forEach((currentValue, index) => { json.forEach((currentValue, index) => {
let notification = {} let notification = {}
@ -136,19 +136,19 @@ const NotificationDropdown = ({ t }) => {
notification['message'] = json[index]['message']; notification['message'] = json[index]['message'];
notification['created_datetime'] = moment(parseInt(json[index]['created_datetime'])) notification['created_datetime'] = moment(parseInt(json[index]['created_datetime']))
.format("YYYY-MM-DD HH:mm:ss"); .format("YYYY-MM-DD HH:mm:ss");
if (NewnotificationList.length > 3 ){ if (NewNotificationList.length > 3 ){
return true return true
} }
if (notification['message'].length > 40){ if (notification['message'].length > 40){
notification['message'] = notification['message'].substring(0,30) + "..."; notification['message'] = notification['message'].substring(0,30) + "...";
} }
if (notification["status"] === "new"){ if (notification["status"] === "new"){
NewnotificationList.push(notification); NewNotificationList.push(notification);
} }
}); });
} }
setRawNewNotificationschild(NewnotificationList); setRawNewNotificationschild(NewNotificationList);
} }
}).catch(err => { }).catch(err => {
console.log(err); console.log(err);