14th_check

This commit is contained in:
beabigegg
2025-09-04 11:31:53 +08:00
parent e5fd3e5ec3
commit e680d2af5a
3 changed files with 30 additions and 19 deletions

View File

@@ -246,7 +246,13 @@ const handleMenuClick = () => {
const showNotifications = async () => {
notificationDrawerVisible.value = true
// 載入最新通知
await notificationStore.fetchNotifications()
console.log('🔔 正在載入通知...')
try {
await notificationStore.fetchNotifications()
console.log('🔔 通知載入完成:', notificationStore.notifications.length)
} catch (error) {
console.error('🔔 通知載入失敗:', error)
}
}
const handleUserMenuCommand = async (command) => {
@@ -331,7 +337,12 @@ onMounted(() => {
// initWebSocket()
// 載入通知
notificationStore.fetchNotifications()
console.log('🔔 初始化載入通知...')
notificationStore.fetchNotifications().then(() => {
console.log('🔔 初始化通知載入完成:', notificationStore.notifications.length)
}).catch(error => {
console.error('🔔 初始化通知載入失敗:', error)
})
// 監聽窗口大小變化
window.addEventListener('resize', handleResize)

View File

@@ -29,14 +29,14 @@ export const notificationAPI = {
* @param {string} notificationId - 通知ID
*/
markAsRead(notificationId) {
return request.put(`/notifications/${notificationId}/read`)
return request.post(`/notifications/${notificationId}/read`)
},
/**
* 標記所有通知為已讀
*/
markAllAsRead() {
return request.put('/notifications/mark-all-read')
return request.post('/notifications/read-all')
},
/**