UNPKG

contentful-management

Version:
26 lines 851 B
import * as raw from './raw'; export const getMany = (http, params) => { return raw.get(http, `/organizations`, { params: params === null || params === void 0 ? void 0 : params.query }); }; export const get = (http, params) => { return getMany(http, { query: { limit: 100 } }).then(data => { const org = data.items.find(org => org.sys.id === params.organizationId); if (!org) { const error = new Error(`No organization was found with the ID ${params.organizationId} instead got ${JSON.stringify(data)}`); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore error.status = 404; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore error.statusText = 'Not Found'; return Promise.reject(error); } return org; }); };