feat: Add store and API to support articles in widget (#7616)

This commit is contained in:
Nithin David Thomas
2023-07-27 02:38:27 +05:30
committed by GitHub
parent 12c338364e
commit 89e09857af
5 changed files with 200 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
import endPoints from 'widget/api/endPoints';
import { API } from 'widget/helpers/axios';
export const getMostReadArticles = async (slug, locale) => {
const urlData = endPoints.getMostReadArticles(slug, locale);
return API.get(urlData.url, { params: urlData.params });
};

View File

@@ -93,6 +93,13 @@ const triggerCampaign = ({ websiteToken, campaignId, customAttributes }) => ({
},
});
const getMostReadArticles = (slug, locale) => ({
url: `/hc/${slug}/${locale}/articles.json`,
params: {
page: 1,
},
});
export default {
createConversation,
sendMessage,
@@ -102,4 +109,5 @@ export default {
getAvailableAgents,
getCampaigns,
triggerCampaign,
getMostReadArticles,
};