From bc7ff543802b7efb395078727c5c7927a97a5d79 Mon Sep 17 00:00:00 2001 From: seaznCode Date: Wed, 28 Jan 2026 20:14:53 +0100 Subject: [PATCH] feat: enhance delete method to support request body and add removePoolMembers API --- src/app/utils/api.ts | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/app/utils/api.ts b/src/app/utils/api.ts index f87250a..604f250 100644 --- a/src/app/utils/api.ts +++ b/src/app/utils/api.ts @@ -154,8 +154,15 @@ export class ApiClient { ) } - static async delete(endpoint: string, token?: string): Promise { - return this.makeRequest(endpoint, { method: 'DELETE' }, token) + static async delete(endpoint: string, token?: string, data?: any): Promise { + return this.makeRequest( + endpoint, + { + method: 'DELETE', + body: data ? JSON.stringify(data) : undefined, + }, + token + ) } } @@ -365,6 +372,16 @@ export class AdminAPI { return response.json() } + static async removePoolMembers(token: string, poolId: string | number, userIds: Array) { + const endpoint = API_ENDPOINTS.ADMIN_POOL_MEMBERS.replace(':id', String(poolId)) + const response = await ApiClient.delete(endpoint, token, { userIds }) + if (!response.ok) { + const error = await response.json().catch(() => ({ message: 'Failed to remove pool members' })) + throw new Error(error.message || 'Failed to remove pool members') + } + return response.json() + } + static async updateUserStatus(token: string, userId: string, status: string) { const endpoint = API_ENDPOINTS.ADMIN_UPDATE_USER_STATUS.replace(':id', userId) const response = await ApiClient.patch(endpoint, { status }, token)