|
@@ -26,7 +26,7 @@ const NotificationIconWidget = () => {
|
|
|
}
|
|
}
|
|
|
const now = new Date();
|
|
const now = new Date();
|
|
|
const notificationUpdatedAt = localStorage.getItem(
|
|
const notificationUpdatedAt = localStorage.getItem(
|
|
|
- "notification/updatedAt"
|
|
|
|
|
|
|
+ "notification/updatedAt",
|
|
|
);
|
|
);
|
|
|
if (notificationUpdatedAt) {
|
|
if (notificationUpdatedAt) {
|
|
|
if (now.getTime() - parseInt(notificationUpdatedAt) < 59000) {
|
|
if (now.getTime() - parseInt(notificationUpdatedAt) < 59000) {
|
|
@@ -46,7 +46,7 @@ const NotificationIconWidget = () => {
|
|
|
console.debug("notification fetch ok ", json.data.unread);
|
|
console.debug("notification fetch ok ", json.data.unread);
|
|
|
localStorage.setItem(
|
|
localStorage.setItem(
|
|
|
"notification/updatedAt",
|
|
"notification/updatedAt",
|
|
|
- now.getTime().toString()
|
|
|
|
|
|
|
+ now.getTime().toString(),
|
|
|
);
|
|
);
|
|
|
localStorage.setItem("notification/count", json.data.unread.toString());
|
|
localStorage.setItem("notification/count", json.data.unread.toString());
|
|
|
setCount(json.data.unread);
|
|
setCount(json.data.unread);
|
|
@@ -60,7 +60,7 @@ const NotificationIconWidget = () => {
|
|
|
const content = json.data.rows[0].content;
|
|
const content = json.data.rows[0].content;
|
|
|
localStorage.setItem(
|
|
localStorage.setItem(
|
|
|
"notification/message",
|
|
"notification/message",
|
|
|
- JSON.stringify({ title: title, content: content })
|
|
|
|
|
|
|
+ JSON.stringify({ title: title, content: content }),
|
|
|
);
|
|
);
|
|
|
//发送通知
|
|
//发送通知
|
|
|
console.debug("notification isMute", isMute, mute);
|
|
console.debug("notification isMute", isMute, mute);
|
|
@@ -70,7 +70,7 @@ const NotificationIconWidget = () => {
|
|
|
const notification = new Notification(title, {
|
|
const notification = new Notification(title, {
|
|
|
body: content,
|
|
body: content,
|
|
|
icon:
|
|
icon:
|
|
|
- process.env.REACT_APP_API_HOST +
|
|
|
|
|
|
|
+ process.env.REACT_APP_API_BASE +
|
|
|
"/assets/images/wikipali_logo.png",
|
|
"/assets/images/wikipali_logo.png",
|
|
|
tag: json.data.rows[0].id,
|
|
tag: json.data.rows[0].id,
|
|
|
});
|
|
});
|