From 9926e8d15cf9c604c908f0eed23c699cf2c0472f Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Tue, 3 Dec 2024 10:23:38 +0000 Subject: [PATCH] Type route endpoints --- .../frontend-core/src/api/{routes.js => routes.ts} | 10 +++++++++- packages/frontend-core/src/api/types.ts | 4 +++- 2 files changed, 12 insertions(+), 2 deletions(-) rename packages/frontend-core/src/api/{routes.js => routes.ts} (52%) diff --git a/packages/frontend-core/src/api/routes.js b/packages/frontend-core/src/api/routes.ts similarity index 52% rename from packages/frontend-core/src/api/routes.js rename to packages/frontend-core/src/api/routes.ts index 28e206debc..7d2df98b57 100644 --- a/packages/frontend-core/src/api/routes.js +++ b/packages/frontend-core/src/api/routes.ts @@ -1,4 +1,12 @@ -export const buildRouteEndpoints = API => ({ +import { BaseAPIClient } from "./types" + +export interface RouteEndpoints { + // Missing request or response types + fetchClientAppRoutes: () => Promise<{ routes: any }> + fetchAppRoutes: () => Promise<{ routes: any }> +} + +export const buildRouteEndpoints = (API: BaseAPIClient): RouteEndpoints => ({ /** * Fetches available routes for the client app. */ diff --git a/packages/frontend-core/src/api/types.ts b/packages/frontend-core/src/api/types.ts index 176e7f6a32..f3cf6b034f 100644 --- a/packages/frontend-core/src/api/types.ts +++ b/packages/frontend-core/src/api/types.ts @@ -22,6 +22,7 @@ import { PluginEndpoins } from "./plugins" import { QueryEndpoints } from "./queries" import { RelationshipEndpoints } from "./relationships" import { RoleEndpoints } from "./roles" +import { RouteEndpoints } from "./routes" export enum HTTPMethod { POST = "POST", @@ -115,4 +116,5 @@ export type APIClient = BaseAPIClient & PluginEndpoins & QueryEndpoints & RelationshipEndpoints & - RoleEndpoints & { [key: string]: any } + RoleEndpoints & + RouteEndpoints & { [key: string]: any }