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);
|
2022-10-14 03:43:11 +00:00
|
|
|
return API.get(urlData.url, { params: urlData.params });
|
2021-05-10 07:31:00 +00:00
|
|
|
};
|
|
|
|
|
2022-04-20 05:19:52 +00:00
|
|
|
const triggerCampaign = async ({
|
|
|
|
campaignId,
|
|
|
|
websiteToken,
|
|
|
|
customAttributes,
|
|
|
|
}) => {
|
|
|
|
const urlData = endPoints.triggerCampaign({
|
|
|
|
websiteToken,
|
|
|
|
campaignId,
|
|
|
|
customAttributes,
|
|
|
|
});
|
2021-05-10 07:31:00 +00:00
|
|
|
await API.post(
|
|
|
|
urlData.url,
|
|
|
|
{ ...urlData.data },
|
|
|
|
{
|
|
|
|
params: urlData.params,
|
|
|
|
}
|
|
|
|
);
|
|
|
|
};
|
|
|
|
export { getCampaigns, triggerCampaign };
|