轮询修改,媒体过期判断
This commit is contained in:
@@ -2,6 +2,7 @@ import React, { useEffect, useState, useCallback } from 'react';
|
||||
import { Tag, Typography, Button } from 'antd';
|
||||
import { BellOutlined, ThunderboltOutlined, GiftOutlined, StarOutlined, CloseOutlined } from '@ant-design/icons';
|
||||
import { getNotifications, markNotificationRead } from '../api';
|
||||
import { useAuthStore } from '../store/useAuthStore';
|
||||
|
||||
interface Notification {
|
||||
id: string;
|
||||
@@ -22,6 +23,7 @@ const NotificationPopup: React.FC = () => {
|
||||
const [visible, setVisible] = useState(false);
|
||||
const [notifications, setNotifications] = useState<Notification[]>([]);
|
||||
const [currentIndex, setCurrentIndex] = useState(0);
|
||||
const refreshUser = useAuthStore((state) => state.refreshUser);
|
||||
|
||||
const fetchNotifications = useCallback(async () => {
|
||||
try {
|
||||
@@ -52,6 +54,8 @@ const NotificationPopup: React.FC = () => {
|
||||
setVisible(false);
|
||||
setNotifications([]);
|
||||
setCurrentIndex(0);
|
||||
// 刷新用户信息(包括积分)
|
||||
try { await refreshUser(); } catch { /* ignore */ }
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user