diff --git a/frontend/pages/profile/notifications.vue b/frontend/pages/profile/notifications.vue index 9ba8144..ce345bf 100644 --- a/frontend/pages/profile/notifications.vue +++ b/frontend/pages/profile/notifications.vue @@ -5,12 +5,127 @@ definePageMeta({ middleware: "check-is-logged-in", layout: "profile", }); + +// imports + +import { usePushNotifications } from "~/composables/global/usePushNotifications"; +import useSubscribeNotification from "~/composables/api/notifications/useSubscribeNotification"; + +// state + +const params = useUrlSearchParams("history"); + +const subscribe = ref(false); + +const sortFilters = ref([ + { + title: "جدید ترین", + value: "created_at", + }, + { + title: "قدیمی ترین", + value: "-created_at", + }, +]); + +// queries + +const { + isSupported, + subscribe: notificationSubsribe, + unsubscribe: notificationUnSubsribe, + subscription, +} = usePushNotifications(); + +const { isPending: subscribeNotificationIsPending } = + useSubscribeNotification(); + +// watch + +watch( + () => subscribe.value, + (nv) => { + if (!!subscription && nv) { + notificationSubsribe(); + } else { + notificationUnSubsribe(); + } + } +); - + - + + + + + + دریافت مستقیم اعلانات + + اعلانات حساب شما به صورت مستقیم به دستگاه شما ارسال می + شود + + + + + + + + + + + + 1 اعلان + + فیلتر بر اساس + + + + + + + + + + {{ category.title }} + + + + + + + + + + + + + +