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

@ -135,6 +135,11 @@ const routes: RouteRecordRaw[] = [
name: 'dashBoard',
component: () => import('pages/15_dash-board/MainPage.vue'),
},
{
path: '/notification',
name: 'Notification',
component: () => import('pages/00_notification/MainPage.vue'),
},
],
},
@ -208,7 +213,6 @@ const routes: RouteRecordRaw[] = [
name: 'DebitNoteView',
component: () => import('pages/12_debit-note/FormPage.vue'),
},
{
path: '/debit-note/document-view',
name: 'DebitNoteDocumentView',

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