feat: add notification route and functions to delete and mark notifications as read

This commit is contained in:
puriphatt 2025-03-06 10:46:53 +07:00
parent f9077cc030
commit ede8e80181
2 changed files with 27 additions and 1 deletions

View file

@ -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,
};
});