import apiCrudPOST, { APICrudPostParams } from "./post"; type Params = Omit< APICrudPostParams, "update" > & { targetID: string | number; apiKey?: string; }; export default async function apiCrudPUT< T extends { [key: string]: any } = { [key: string]: any } >({ dbName, tableName, body, targetID, apiKey }: Params) { const updatedBody = { ...body } as any; if (targetID) { updatedBody["id"] = targetID; } return await apiCrudPOST({ dbName, tableName, body: updatedBody, update: true, apiKey, }); }