UNPKG

cluedin-widget

Version:

This project contains all the pages needed for browsing entities and searching them. The aim is to replace the CluedIn.Webapp project with this one when all the pages ( including the Admin page ) will be ported to REACT.

51 lines (37 loc) 1.25 kB
import { apiRequest } from '../helpers/request'; import iso from '../../iso'; export const clearCount = (id) => { const url = `api/insight/count?id=${id}`; return apiRequest('PUT', url).then((resp) => (resp.body)); }; export const getAll = () => { const url = 'api/insight/all'; return apiRequest('GET', url).then((resp) => (resp.body)); }; export const getAllSearches = () => { const url = 'api/search/subscribe'; return apiRequest('GET', url).then((resp) => { if (resp.body && resp.body.length > 0) { resp.body.forEach((s) => { const search = s; search.Name = iso.string.hasStartAsLastCharacter(s.Query) ? iso.string.removeLastCharacter(s.Query) : s.Query; }); } return resp.body; }); }; export const clearSearchCount = (id) => { const url = `api/v1/search/clear?id=${id}`; return apiRequest('PUT', url).then((resp) => (resp.body)); }; export const subscribeSearch = (q) => { const url = `api/search/subscribe?q=${q}`; return apiRequest('POST', url).then((resp) => (resp.body)); }; export const unSubscribeSearch = (q) => { const url = `api/search/unsubscribe?q=${q}`; return apiRequest('POST', url).then((resp) => (resp.body)); };