From f450f49e1b0770fc427a7577ed0323235d8f96f9 Mon Sep 17 00:00:00 2001 From: olexii4 Date: Tue, 12 Sep 2023 11:39:52 +0000 Subject: [PATCH] fix: gettingStarted samples route Signed-off-by: olexii4 --- packages/dashboard-backend/src/app.ts | 2 +- .../src/routes/api/gettingStartedSample.ts | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/dashboard-backend/src/app.ts b/packages/dashboard-backend/src/app.ts index e37bcc621..d99f86fdd 100644 --- a/packages/dashboard-backend/src/app.ts +++ b/packages/dashboard-backend/src/app.ts @@ -112,5 +112,5 @@ export default async function buildApp(server: FastifyInstance): Promise { registerPersonalAccessTokenRoutes(server); - registerGettingStartedSamplesRoutes(server); + registerGettingStartedSamplesRoutes(isLocalRun(), server); } diff --git a/packages/dashboard-backend/src/routes/api/gettingStartedSample.ts b/packages/dashboard-backend/src/routes/api/gettingStartedSample.ts index 55c4f4d9f..f23d39844 100644 --- a/packages/dashboard-backend/src/routes/api/gettingStartedSample.ts +++ b/packages/dashboard-backend/src/routes/api/gettingStartedSample.ts @@ -18,9 +18,15 @@ import { getServiceAccountToken } from './helpers/getServiceAccountToken'; const tags = ['Getting Started Samples']; -export function registerGettingStartedSamplesRoutes(instance: FastifyInstance) { +export function registerGettingStartedSamplesRoutes( + isLocalRun: boolean, + instance: FastifyInstance, +) { instance.register(async server => { server.get(`${baseApiPath}/getting-started-sample`, getSchema({ tags }), async () => { + if (isLocalRun) { + return []; + } const token = getServiceAccountToken(); const { gettingStartedSampleApi } = getDevWorkspaceClient(token); return gettingStartedSampleApi.list();