Chatwoot/app/javascript/dashboard/api/inbox/message.js
2019-10-27 19:01:59 +05:30

24 lines
535 B
JavaScript

/* eslint no-console: 0 */
/* global axios */
import ApiClient from '../ApiClient';
class MessageApi extends ApiClient {
constructor() {
super('conversations');
}
create({ conversationId, message, private: isPrivate }) {
return axios.post(`${this.url}/${conversationId}/messages`, {
message,
private: isPrivate,
});
}
getPreviousMessages({ conversationId, before }) {
return axios.get(`${this.url}/${conversationId}`, {
params: { before },
});
}
}
export default new MessageApi();