add Notify
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
import { axios } from "./BaseAPI";
|
||||
import type { NotifyDetail, Page, PageResult } from "../types";
|
||||
|
||||
const BASE_URI = "/notify/internal";
|
||||
|
||||
/** 查询当前用户的站内通知。 */
|
||||
async function listInternal(page?: Page<NotifyDetail>, unreadOnly = false): Promise<PageResult<NotifyDetail>> {
|
||||
return await axios.post(`${BASE_URI}/internal`, page, {
|
||||
params: { unreadOnly }
|
||||
});
|
||||
}
|
||||
|
||||
/** 查询当前用户未读站内通知数量。 */
|
||||
async function countUnreadInternal(): Promise<number> {
|
||||
return await axios.post(`${BASE_URI}/unread/count`);
|
||||
}
|
||||
|
||||
/** 标记当前用户的一条站内通知已读。 */
|
||||
async function markInternalRead(id: string): Promise<void> {
|
||||
await axios.post(`${BASE_URI}/read`, undefined, {
|
||||
params: { id }
|
||||
});
|
||||
}
|
||||
|
||||
/** 标记当前用户全部站内通知已读。 */
|
||||
async function markAllInternalRead(): Promise<void> {
|
||||
await axios.post(`${BASE_URI}/read/all`);
|
||||
}
|
||||
|
||||
export default {
|
||||
listInternal,
|
||||
countUnreadInternal,
|
||||
markInternalRead,
|
||||
markAllInternalRead
|
||||
};
|
||||
@@ -3,6 +3,7 @@ export { default as AttachmentAPI } from "./AttachmentAPI";
|
||||
export { default as CommentAPI } from "./CommentAPI";
|
||||
export { default as CommonAPI } from "./CommonAPI";
|
||||
export { default as DeveloperAPI } from "./DeveloperAPI";
|
||||
export { default as NotifyAPI } from "./NotifyAPI";
|
||||
export { default as PermissionAPI } from "./PermissionAPI";
|
||||
export { default as RoleAPI } from "./RoleAPI";
|
||||
export { default as UserAPI } from "./UserAPI";
|
||||
|
||||
Reference in New Issue
Block a user