UNPKG

autumn-js

Version:

Autumn JS Library

37 lines (32 loc) 880 B
"use client"; import { toSnakeCase } from "./chunk-ZNPQQ2WK.mjs"; // src/utils/entityUtils.tsx var getEntityExpandStr = (expand) => { if (!expand) { return ""; } return `expand=${expand.join(",")}`; }; // src/libraries/react/client/clientEntityMethods.ts async function createEntityMethod(params) { let snakeParams = toSnakeCase(params); const res = await this.post("/api/autumn/entities", snakeParams); return res; } async function getEntityMethod(entityId, params) { let snakeParams = toSnakeCase(params); let expand = getEntityExpandStr(params?.expand); const res = await this.get(`/api/autumn/entities/${entityId}?${expand}`); return res; } async function deleteEntityMethod(entityId) { const res = await this.delete(`/api/autumn/entities/${entityId}`); return res; } export { createEntityMethod, getEntityMethod, deleteEntityMethod };