simple-strapi 1.0.0-alpha.13 → 1.0.0-alpha.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client.d.ts +4 -0
- package/dist/client.js +35 -0
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -125,5 +125,9 @@ declare class Client {
|
|
|
125
125
|
meta: any;
|
|
126
126
|
}>;
|
|
127
127
|
private writeRequest;
|
|
128
|
+
/**
|
|
129
|
+
* Elimina un'entità specifica tramite il suo documentId.
|
|
130
|
+
*/
|
|
131
|
+
delete(pluralID: string, documentId: string, options?: EntityRequest): Promise<unknown>;
|
|
128
132
|
}
|
|
129
133
|
export default Client;
|
package/dist/client.js
CHANGED
|
@@ -335,6 +335,41 @@ class Client {
|
|
|
335
335
|
throw ensureSimpleException(exception);
|
|
336
336
|
}
|
|
337
337
|
}
|
|
338
|
+
/**
|
|
339
|
+
* Elimina un'entità specifica tramite il suo documentId.
|
|
340
|
+
*/
|
|
341
|
+
async delete(pluralID, documentId, options = {}) {
|
|
342
|
+
try {
|
|
343
|
+
const { params = {}, headers = {} } = options;
|
|
344
|
+
const requestURL = Client.getRequestURL({
|
|
345
|
+
origin: this.origin,
|
|
346
|
+
pathname: join(this.pathname, pluralID, documentId),
|
|
347
|
+
params,
|
|
348
|
+
});
|
|
349
|
+
const response = await fetch(requestURL, {
|
|
350
|
+
method: "DELETE",
|
|
351
|
+
headers: {
|
|
352
|
+
...this.getAuthorizedHeaders(),
|
|
353
|
+
...headers,
|
|
354
|
+
},
|
|
355
|
+
});
|
|
356
|
+
if (!response.ok) {
|
|
357
|
+
throw createSimpleException({
|
|
358
|
+
code: response.status,
|
|
359
|
+
message: response.statusText,
|
|
360
|
+
type: "error",
|
|
361
|
+
source: "strapi-utils/client.ts",
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
const { data, meta } = z
|
|
365
|
+
.object({ data: z.any(), meta: z.any() })
|
|
366
|
+
.parse(await response.json());
|
|
367
|
+
return { data, meta };
|
|
368
|
+
}
|
|
369
|
+
catch (exception) {
|
|
370
|
+
throw ensureSimpleException(exception);
|
|
371
|
+
}
|
|
372
|
+
}
|
|
338
373
|
}
|
|
339
374
|
// #region STATIC
|
|
340
375
|
Client.headers = {
|