Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | 27x 117x 27x 117x 117x 117x 27x 34x | import { customInstance } from "..";
import { TQueryParams, queryGenerator } from "@utils/generators/queryGenerator";
export const getHasNewNotifications = (
merchantId: number,
userId: number,
filterByMandatory = false,
) => {
return getUserNotifications(merchantId, userId, {
filter: {
readAt: null,
...(filterByMandatory && {
alertType: `"mandatory"`,
}),
},
max: 1,
});
};
export const getUserNotifications = (
merchantId: number,
userId: number,
params?: TQueryParams,
) => {
const baseURL = `/accounts/${merchantId}/members/${userId}/push-notifications`;
const url = queryGenerator(baseURL, params);
return customInstance({
url,
method: "GET",
});
};
type AllMark = "*";
export type TNotificationIds = Array<number | AllMark | string>;
export const markAsRead = (
merchantId: number,
userId: number,
notificationsIds: TNotificationIds,
) => {
return customInstance({
url: `/accounts/${merchantId}/members/${userId}/push-notifications/read`,
method: "PUT",
data: {
pushNotificationIDs: notificationsIds,
},
});
};
|