2019-10-29 07:20:54 +00:00
|
|
|
import endPoints from 'widget/api/endPoints';
|
|
|
|
import { API } from 'widget/helpers/axios';
|
|
|
|
|
|
|
|
const sendMessageAPI = async content => {
|
|
|
|
const urlData = endPoints.sendMessage(content);
|
|
|
|
const result = await API.post(urlData.url, urlData.params);
|
|
|
|
return result;
|
|
|
|
};
|
|
|
|
|
2020-03-30 06:45:06 +00:00
|
|
|
const sendAttachmentAPI = async attachment => {
|
2020-04-17 15:45:20 +00:00
|
|
|
const urlData = endPoints.sendAttachment(attachment);
|
2020-03-30 06:45:06 +00:00
|
|
|
const result = await API.post(urlData.url, urlData.params);
|
|
|
|
return result;
|
|
|
|
};
|
|
|
|
|
2019-12-11 15:27:06 +00:00
|
|
|
const getConversationAPI = async ({ before }) => {
|
|
|
|
const urlData = endPoints.getConversation({ before });
|
|
|
|
const result = await API.get(urlData.url, { params: urlData.params });
|
2019-10-29 07:20:54 +00:00
|
|
|
return result;
|
|
|
|
};
|
|
|
|
|
2020-03-30 06:45:06 +00:00
|
|
|
export { sendMessageAPI, getConversationAPI, sendAttachmentAPI };
|