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.
27 lines (21 loc) • 701 B
JavaScript
/* eslint no-underscore-dangle: ["error", { "allow": ["__token"] }]*/
import { apiRequest } from '../helpers/request';
import entityAPI from '../../iso/entity';
export const getLastOrganizations = (page) => {
let url = 'api/v1/generic/latestorganizations';
if (page) {
url += `?page=${page}`;
}
return apiRequest('GET', url)
.then((resp) => (
resp.body.map((entity) => (entityAPI.toVM(entity, true, resp.__token)))
));
};
export const current = () => (
apiRequest('GET', 'api/organization')
.then((resp) => (resp.body))
);
export const getById = (id) => (
apiRequest('GET', `api/entity/code?id=/Organization%23CluedIn:${id}`)
.then((resp) => (resp.body))
);