63 lines
1.4 KiB
JavaScript
63 lines
1.4 KiB
JavaScript
import { request } from '@/utils/request'
|
|
|
|
/**
|
|
* 通知相關 API 服務
|
|
*/
|
|
export const notificationAPI = {
|
|
/**
|
|
* 獲取通知列表
|
|
* @param {Object} params - 查詢參數
|
|
* @param {number} params.page - 頁碼
|
|
* @param {number} params.per_page - 每頁數量
|
|
* @param {string} params.status - 狀態過濾 ('all', 'unread', 'read')
|
|
* @param {string} params.type - 類型過濾
|
|
*/
|
|
getNotifications(params = {}) {
|
|
return request.get('/notifications', { params })
|
|
},
|
|
|
|
/**
|
|
* 獲取單個通知詳情
|
|
* @param {string} notificationId - 通知ID
|
|
*/
|
|
getNotification(notificationId) {
|
|
return request.get(`/notifications/${notificationId}`)
|
|
},
|
|
|
|
/**
|
|
* 標記通知為已讀
|
|
* @param {string} notificationId - 通知ID
|
|
*/
|
|
markAsRead(notificationId) {
|
|
return request.post(`/notifications/${notificationId}/read`)
|
|
},
|
|
|
|
/**
|
|
* 標記所有通知為已讀
|
|
*/
|
|
markAllAsRead() {
|
|
return request.post('/notifications/read-all')
|
|
},
|
|
|
|
/**
|
|
* 刪除通知
|
|
* @param {string} notificationId - 通知ID
|
|
*/
|
|
deleteNotification(notificationId) {
|
|
return request.delete(`/notifications/${notificationId}`)
|
|
},
|
|
|
|
/**
|
|
* 清空所有已讀通知
|
|
*/
|
|
clearNotifications() {
|
|
return request.delete('/notifications/clear')
|
|
},
|
|
|
|
/**
|
|
* 創建測試通知(開發用)
|
|
*/
|
|
createTestNotification() {
|
|
return request.post('/notifications/test')
|
|
}
|
|
} |