Chatwoot/app/javascript/dashboard/api/inbox/conversation.js
Subin T P 84799fd0a1 [#247] Filters conversation by status and paginate conversations (#284)
* [#247] Filters conversation by status

* Fixes conversation finder specs

* [#248] Paginates conversation

* Use method name in description

* Move page to default param, add filters on frontend

* Fix code climate issues
2019-12-01 10:16:51 +05:30

37 lines
805 B
JavaScript

/* global axios */
import ApiClient from '../ApiClient';
class ConversationApi extends ApiClient {
constructor() {
super('conversations');
}
get({ inboxId, status, assigneeType }) {
return axios.get(this.url, {
params: {
inbox_id: inboxId,
status,
assignee_type_id: assigneeType,
},
});
}
toggleStatus(conversationId) {
return axios.post(`${this.url}/${conversationId}/toggle_status`, {});
}
assignAgent({ conversationId, agentId }) {
axios.post(
`${this.url}/${conversationId}/assignments?assignee_id=${agentId}`,
{}
);
}
markMessageRead({ id, lastSeen }) {
return axios.post(`${this.url}/${id}/update_last_seen`, {
agent_last_seen_at: lastSeen,
});
}
}
export default new ConversationApi();