From 31924e9a49d38a26362b07eadcbdcf86689513f3 Mon Sep 17 00:00:00 2001 From: Mirasaki Date: Wed, 14 Aug 2024 16:58:05 +0200 Subject: [PATCH] fix(app-grants): fix raw response structure --- src/internal/got/client.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/internal/got/client.ts b/src/internal/got/client.ts index d299607..d41af3d 100644 --- a/src/internal/got/client.ts +++ b/src/internal/got/client.ts @@ -78,8 +78,10 @@ interface RawServerAppGrant { interface RawAppGrants { status: boolean; - banlist: RawBanListAppGrant[], - server: RawServerAppGrant[], + tokens?: { + banlist?: RawBanListAppGrant[]; + server?: RawServerAppGrant[]; + }; } export class GotCFToolsClient implements CFToolsClient { @@ -99,12 +101,12 @@ export class GotCFToolsClient implements CFToolsClient { }, }); return { - banlist: response.banlist?.map((e) => ({ + banlist: response.tokens?.banlist?.map((e) => ({ ...e, created: new Date(e.created_at), created_at: undefined })) ?? [], - server: response.server?.map((e) => ({ + server: response.tokens?.server?.map((e) => ({ ...e, created: new Date(e.created_at), created_at: undefined