mirror of
				https://github.com/lingble/chatwoot.git
				synced 2025-11-03 20:48:07 +00:00 
			
		
		
		
	* feat: Inbox list filter * fix: routes after delete/unread * fix: Specs * feat: Handle sort in frontend * chore: Minor fixes * chore: Minor fix --------- Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com>
		
			
				
	
	
		
			61 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			61 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
/* global axios */
 | 
						|
import ApiClient from './ApiClient';
 | 
						|
 | 
						|
class NotificationsAPI extends ApiClient {
 | 
						|
  constructor() {
 | 
						|
    super('notifications', { accountScoped: true });
 | 
						|
  }
 | 
						|
 | 
						|
  get({ page, status, type, sortOrder }) {
 | 
						|
    return axios.get(this.url, {
 | 
						|
      params: {
 | 
						|
        page,
 | 
						|
        status,
 | 
						|
        type,
 | 
						|
        sort_order: sortOrder,
 | 
						|
      },
 | 
						|
    });
 | 
						|
  }
 | 
						|
 | 
						|
  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();
 |