Files
chatwoot/app/javascript/dashboard/api/notifications.js
Sivin Varghese 9e0468cd73 feat: Inbox header actions (Snooze/Delete) (#8858)
* feat: Inbox header actions (Snooze/Delete)

* chore: Minor fix

* chore: Fix eslint

* Update inboxHotKeys.js

* feat: custom snooze

* Update actions.spec.js

* chore: Clean up

* chore: add snoozed_until to notification end point

* chore: Minor fix

* chore: Minor style fix

* chore:Clean up

* chore: review fixes

* chore: Minor fix

* chore: Adds alert

---------

Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com>
2024-02-06 08:54:15 +05:30

54 lines
1.1 KiB
JavaScript

/* global axios */
import ApiClient from './ApiClient';
class NotificationsAPI extends ApiClient {
constructor() {
super('notifications', { accountScoped: true });
}
get(page) {
return axios.get(`${this.url}?page=${page}`);
}
getNotifications(contactId) {
return axios.get(`${this.url}/${contactId}/notifications`);
}
getUnreadCount() {
return axios.get(`${this.url}/unread_count`);
}
read(primaryActorType, primaryActorId) {
return axios.post(`${this.url}/read_all`, {
primary_actor_type: primaryActorType,
primary_actor_id: primaryActorId,
});
}
unRead(id) {
return axios.post(`${this.url}/${id}/unread`);
}
readAll() {
return axios.post(`${this.url}/read_all`);
}
delete(id) {
return axios.delete(`${this.url}/${id}`);
}
deleteAll({ type = 'all' }) {
return axios.post(`${this.url}/destroy_all`, {
type,
});
}
snooze({ id, snoozedUntil = null }) {
return axios.post(`${this.url}/${id}/snooze`, {
snoozed_until: snoozedUntil,
});
}
}
export default new NotificationsAPI();