From 610133551e7a61c59b34f542b6503a9d7ec930b7 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Tue, 10 Dec 2024 13:00:51 +0000 Subject: [PATCH] Update self endpoints --- packages/frontend-core/src/api/routes.ts | 1 - packages/frontend-core/src/api/self.ts | 20 +++++++++----------- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/packages/frontend-core/src/api/routes.ts b/packages/frontend-core/src/api/routes.ts index 1db7b473de..0adedf15e2 100644 --- a/packages/frontend-core/src/api/routes.ts +++ b/packages/frontend-core/src/api/routes.ts @@ -5,7 +5,6 @@ import { import { BaseAPIClient } from "./types" export interface RouteEndpoints { - // Missing request or response types fetchClientAppRoutes: () => Promise fetchAppRoutes: () => Promise } diff --git a/packages/frontend-core/src/api/self.ts b/packages/frontend-core/src/api/self.ts index 9e8c806b2f..db5b1226eb 100644 --- a/packages/frontend-core/src/api/self.ts +++ b/packages/frontend-core/src/api/self.ts @@ -1,21 +1,19 @@ import { - ContextUser, + AppSelfResponse, + FetchAPIKeyResponse, + GenerateAPIKeyResponse, + GetGlobalSelfResponse, UpdateSelfRequest, UpdateSelfResponse, - User, } from "@budibase/types" import { BaseAPIClient } from "./types" export interface SelfEndpoints { updateSelf: (user: UpdateSelfRequest) => Promise - - // Missing request or response types - generateAPIKey: () => Promise - fetchDeveloperInfo: () => Promise - - // There are flags and session attributes mixed in to the user - fetchBuilderSelf: () => Promise - fetchSelf: () => Promise<(ContextUser | {}) & { [key: string]: any }> + generateAPIKey: () => Promise + fetchDeveloperInfo: () => Promise + fetchBuilderSelf: () => Promise + fetchSelf: () => Promise } export const buildSelfEndpoints = (API: BaseAPIClient): SelfEndpoints => ({ @@ -24,7 +22,7 @@ export const buildSelfEndpoints = (API: BaseAPIClient): SelfEndpoints => ({ * assuming the user is a builder. */ generateAPIKey: async () => { - const response = await API.post({ + const response = await API.post({ url: "/api/global/self/api_key", }) return response?.apiKey