mirror of
https://github.com/lingble/chatwoot.git
synced 2026-03-20 03:52:43 +00:00
48 lines
962 B
JavaScript
48 lines
962 B
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,
|
|
});
|
|
}
|
|
}
|
|
|
|
export default new NotificationsAPI();
|