2021-05-10 07:31:00 +00:00
|
|
|
import endPoints from 'widget/api/endPoints';
|
|
|
|
import { API } from 'widget/helpers/axios';
|
|
|
|
|
|
|
|
const getCampaigns = async websiteToken => {
|
|
|
|
const urlData = endPoints.getCampaigns(websiteToken);
|
|
|
|
const result = await API.get(urlData.url, { params: urlData.params });
|
|
|
|
return result;
|
|
|
|
};
|
|
|
|
|
2021-06-15 14:39:42 +00:00
|
|
|
const triggerCampaign = async ({ campaignId, websiteToken }) => {
|
2021-05-17 16:08:35 +00:00
|
|
|
const urlData = endPoints.triggerCampaign({ websiteToken, campaignId });
|
2021-05-10 07:31:00 +00:00
|
|
|
|
|
|
|
await API.post(
|
|
|
|
urlData.url,
|
|
|
|
{ ...urlData.data },
|
|
|
|
{
|
|
|
|
params: urlData.params,
|
|
|
|
}
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export { getCampaigns, triggerCampaign };
|