feat: rating
This commit is contained in:
60
api/notification.js
Normal file
60
api/notification.js
Normal file
@@ -0,0 +1,60 @@
|
||||
import { request } from "@/utils/request.js";
|
||||
|
||||
export const RatingNotificationTypeEnum = {
|
||||
TOPIC_SUBMIT: 'topic_submit',
|
||||
TOPIC_APPROVED: 'topic_approved',
|
||||
TOPIC_REJECTED: 'topic_rejected',
|
||||
ITEM_SUBMIT: 'item_submit',
|
||||
ITEM_APPROVED: 'item_approved',
|
||||
ITEM_REJECTED: 'item_rejected',
|
||||
COMMENT: 'comment',
|
||||
COMMENT_LIKE: 'comment_like',
|
||||
SYSTEM: 'system',
|
||||
}
|
||||
/**
|
||||
* @description: 获取当前用户的消息列表
|
||||
* @param {page: number, type?: RatingNotificationTypeEnum} data
|
||||
* @return
|
||||
*/
|
||||
export const fetchNotificationList = async (data) => {
|
||||
return request({
|
||||
url: "/api/rating/personal/notification/list",
|
||||
method: "GET",
|
||||
data,
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @description: 获取当前用户未读消息数量
|
||||
* @return
|
||||
*/
|
||||
|
||||
export const fetchUnreadCount = async () => {
|
||||
return request({
|
||||
url: "/api/rating/personal/notification/unread_count",
|
||||
method: "GET",
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @description: 标记指定消息为已读
|
||||
* @param {id: number} data
|
||||
* @return
|
||||
*/
|
||||
export const markAsRead = async (id) => {
|
||||
return request({
|
||||
url: "/api/rating/personal/notification/read/" + id,
|
||||
method: "Patch",
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @description: 标记所有消息为已读
|
||||
* @return
|
||||
*/
|
||||
export const markAllAsRead = async () => {
|
||||
return request({
|
||||
url: "/api/rating/personal/notification/read_all",
|
||||
method: "Patch",
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user