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.
29 lines (23 loc) • 591 B
JavaScript
/* eslint no-underscore-dangle: ["error", { "allow": ["__token"] }]*/
import entityAPI from '../../iso/entity';
import { apiRequest } from '../helpers/request';
export function getLastDeals(pageNumber, id) {
let url = 'api/v1/generic/latestdeals';
if (id) {
url += `?id=${id}`;
}
if (pageNumber) {
if (!id) {
url += '?';
} else {
url += '&';
}
url += `page=${pageNumber}`;
}
return apiRequest('GET', url).then((resp) => (
resp.body.map((entity) => (entityAPI.toVM(entity, true, resp.__token)))
));
}
export default {
getLastDeals,
};