Jelajahi Sumber

添加 tag 防止同一消息多次弹窗

visuddhinanda 2 tahun lalu
induk
melakukan
dfb62b93fa
1 mengubah file dengan 2 tambahan dan 0 penghapusan
  1. 2 0
      dashboard/src/components/notification/NotificationIcon.tsx

+ 2 - 0
dashboard/src/components/notification/NotificationIcon.tsx

@@ -10,6 +10,7 @@ const NotificationIconWidget = () => {
   useEffect(() => {
   useEffect(() => {
     let timer = setInterval(() => {
     let timer = setInterval(() => {
       const url = `/v2/notification?view=to&status=unread&limit=1`;
       const url = `/v2/notification?view=to&status=unread&limit=1`;
+      console.info("url", url);
       get<INotificationListResponse>(url).then((json) => {
       get<INotificationListResponse>(url).then((json) => {
         if (json.ok) {
         if (json.ok) {
           setCount(json.data.count);
           setCount(json.data.count);
@@ -25,6 +26,7 @@ const NotificationIconWidget = () => {
                     icon:
                     icon:
                       process.env.REACT_APP_API_HOST +
                       process.env.REACT_APP_API_HOST +
                       "/assets/images/wikipali_logo.png",
                       "/assets/images/wikipali_logo.png",
+                    tag: json.data.rows[0].id,
                   });
                   });
                   notification.onclick = (event) => {
                   notification.onclick = (event) => {
                     event.preventDefault(); // 阻止浏览器聚焦于 Notification 的标签页
                     event.preventDefault(); // 阻止浏览器聚焦于 Notification 的标签页