UNPKG

autumn-js

Version:
32 lines (27 loc) 750 B
"use client"; // src/utils/entityUtils.tsx var getEntityExpandStr = (expand) => { if (!expand) { return ""; } return `expand=${expand.join(",")}`; }; // src/libraries/react/client/clientEntityMethods.ts async function createEntityMethod(params) { const res = await this.post(`${this.prefix}/entities`, params); return res; } async function getEntityMethod(entityId, params) { const expand = getEntityExpandStr(params?.expand); const res = await this.get(`${this.prefix}/entities/${entityId}?${expand}`); return res; } async function deleteEntityMethod(entityId) { const res = await this.delete(`${this.prefix}/entities/${entityId}`); return res; } export { createEntityMethod, getEntityMethod, deleteEntityMethod };