From caa3fbe0aab77d1a9e5a1ff7f3f9cfcde8af56ba Mon Sep 17 00:00:00 2001 From: Hanxing Yang Date: Tue, 15 Oct 2024 17:40:54 +0800 Subject: [PATCH] fix api calling (#984) --- spx-gui/src/apis/common/client.ts | 1 + spx-gui/src/apis/user.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/spx-gui/src/apis/common/client.ts b/spx-gui/src/apis/common/client.ts index bd75bfc37..9770dc968 100644 --- a/spx-gui/src/apis/common/client.ts +++ b/spx-gui/src/apis/common/client.ts @@ -68,6 +68,7 @@ export class Client { } throw new ApiException(body.code, body.msg) } + if (resp.status === 204) return null return resp.json() } diff --git a/spx-gui/src/apis/user.ts b/spx-gui/src/apis/user.ts index 48d759030..96b7821a0 100644 --- a/spx-gui/src/apis/user.ts +++ b/spx-gui/src/apis/user.ts @@ -49,7 +49,7 @@ export type ListUserParams = PaginationParams & { } export async function listUsers(params: ListUserParams) { - const { total, data } = await (client.get('/users/list', { params }) as Promise>) + const { total, data } = await (client.get('/users/list', params) as Promise>) return { total, data: data.map(__adaptUser)