Restructure omni services and add Chatwoot research snapshot
This commit is contained in:
27
research/chatwoot/app/javascript/widget/api/campaign.js
Normal file
27
research/chatwoot/app/javascript/widget/api/campaign.js
Normal file
@@ -0,0 +1,27 @@
|
||||
import endPoints from 'widget/api/endPoints';
|
||||
import { API } from 'widget/helpers/axios';
|
||||
|
||||
const getCampaigns = async websiteToken => {
|
||||
const urlData = endPoints.getCampaigns(websiteToken);
|
||||
return API.get(urlData.url, { params: urlData.params });
|
||||
};
|
||||
|
||||
const triggerCampaign = async ({
|
||||
campaignId,
|
||||
websiteToken,
|
||||
customAttributes,
|
||||
}) => {
|
||||
const urlData = endPoints.triggerCampaign({
|
||||
websiteToken,
|
||||
campaignId,
|
||||
customAttributes,
|
||||
});
|
||||
await API.post(
|
||||
urlData.url,
|
||||
{ ...urlData.data },
|
||||
{
|
||||
params: urlData.params,
|
||||
}
|
||||
);
|
||||
};
|
||||
export { getCampaigns, triggerCampaign };
|
||||
Reference in New Issue
Block a user