feat: add notification route and functions to delete and mark notifications as read
This commit is contained in:
parent
f9077cc030
commit
ede8e80181
2 changed files with 27 additions and 1 deletions
|
|
@ -54,6 +54,26 @@ export const useNotification = defineStore('noti-store', () => {
|
|||
return res.data;
|
||||
}
|
||||
|
||||
async function deleteMultiNotification(notificationId: string[]) {
|
||||
const res = await api.delete<Notification & { id: string }>(
|
||||
'/notification',
|
||||
{
|
||||
data: notificationId,
|
||||
},
|
||||
);
|
||||
if (res.status >= 400) return null;
|
||||
return true;
|
||||
}
|
||||
|
||||
async function markReadNotification(notificationId: string[]) {
|
||||
const res = await api.post<Notification & { id: string }>(
|
||||
'/notification/mark-read',
|
||||
{ id: notificationId },
|
||||
);
|
||||
if (res.status >= 400) return null;
|
||||
return true;
|
||||
}
|
||||
|
||||
return {
|
||||
...state,
|
||||
|
||||
|
|
@ -61,5 +81,7 @@ export const useNotification = defineStore('noti-store', () => {
|
|||
getNotificationList,
|
||||
updateNotification,
|
||||
deleteNotification,
|
||||
deleteMultiNotification,
|
||||
markReadNotification,
|
||||
};
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue