Merge remote-tracking branch 'origin/main'

This commit is contained in:
marzban-dev
2025-03-22 23:44:21 +03:30
23 changed files with 322 additions and 65 deletions
@@ -0,0 +1,34 @@
// imports
import { useMutation } from "@tanstack/vue-query";
import { API_ENDPOINTS } from "~/constants";
// types
export type SubscribeNotificationRequest = {
body: PushSubscriptionJSON;
};
const useSubscribeNotification = () => {
// state
const { $axios: axios } = useNuxtApp();
// methods
const handleSubscribeNotification = async (
params: SubscribeNotificationRequest
) => {
const { data } = await axios.post(API_ENDPOINTS.account.subscribe, {
...params.body,
});
return data;
};
return useMutation({
mutationFn: (subscribeData: SubscribeNotificationRequest) =>
handleSubscribeNotification(subscribeData),
});
};
export default useSubscribeNotification;