From 2125b11d6c198d0dc47c01958078232ef272ed82 Mon Sep 17 00:00:00 2001 From: kriptonian1 Date: Sat, 18 May 2024 15:52:18 +0530 Subject: [PATCH] feat(platfrom): add delete method in api client --- apps/platform/src/lib/api-client.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/apps/platform/src/lib/api-client.ts b/apps/platform/src/lib/api-client.ts index fb0a8a10..410f1864 100644 --- a/apps/platform/src/lib/api-client.ts +++ b/apps/platform/src/lib/api-client.ts @@ -70,6 +70,22 @@ class APIClient { credentials: 'include' }) } + + /** + * Sends a DELETE request to the specified URL and returns a Promise that resolves to the response data. + * + * @param url - The URL to send the DELETE request to. + * @returns A Promise that resolves to the response data. + */ + delete(url: string): Promise { + return this.request(url, { + method: 'DELETE', + headers: { + 'Content-Type': 'application/json' + }, + credentials: 'include' + }) + } } export const apiClient = new APIClient(