From 8bc460327440fd23c8d6a6ec9d1e560863668164 Mon Sep 17 00:00:00 2001 From: LandaMm Date: Tue, 3 Jun 2025 12:54:20 +0200 Subject: [PATCH] feat: update api service API --- web/src/api/admin/apiServices.ts | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/web/src/api/admin/apiServices.ts b/web/src/api/admin/apiServices.ts index 452d731..bcc03b3 100644 --- a/web/src/api/admin/apiServices.ts +++ b/web/src/api/admin/apiServices.ts @@ -64,3 +64,28 @@ export const patchToggleApiService = async (id: string): Promise => { return response.data; }; + +export interface UpdateApiServiceRequest { + name: string; + description: string; + redirect_uris: string[]; + scopes: string[]; + grant_types: string[]; +} + +export type UpdateApiServiceResponse = ApiService; + +export const putApiService = async ( + serviceId: string, + req: UpdateApiServiceRequest, +): Promise => { + const response = await axios.put( + `/api/v1/admin/api-services/${serviceId}`, + req, + ); + + if (response.status !== 200 && response.status !== 201) + throw await handleApiError(response); + + return response.data; +};