pleroma/packages/pl-fe/src/actions/push-subscriptions.ts
marcin mikołajczak 966b04fdf0 Call it pl-fe internally
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2024-08-28 13:41:08 +02:00

27 lines
1 KiB
TypeScript

import { getClient } from '../api';
import type { CreatePushNotificationsSubscriptionParams, UpdatePushNotificationsSubscriptionParams } from 'pl-api';
import type { AppDispatch, RootState } from 'pl-fe/store';
const createPushSubscription = (params: CreatePushNotificationsSubscriptionParams) =>
(dispatch: AppDispatch, getState: () => RootState) =>
getClient(getState).pushNotifications.createSubscription(params);
const fetchPushSubscription = () =>
(dispatch: AppDispatch, getState: () => RootState) =>
getClient(getState).pushNotifications.getSubscription();
const updatePushSubscription = (params: UpdatePushNotificationsSubscriptionParams) =>
(dispatch: AppDispatch, getState: () => RootState) =>
getClient(getState).pushNotifications.updateSubscription(params);
const deletePushSubscription = () =>
(dispatch: AppDispatch, getState: () => RootState) =>
getClient(getState).pushNotifications.deleteSubscription();
export {
createPushSubscription,
fetchPushSubscription,
updatePushSubscription,
deletePushSubscription,
};