From 4f1f49e660a8c5215a25c3da69e67952b896d032 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Thu, 9 Feb 2023 11:28:04 +0800 Subject: [PATCH] refactor(nocodb): pr comments --- packages/nocodb/src/lib/meta/api/swagger/redocHtml.ts | 6 +++++- packages/nocodb/src/lib/meta/api/swagger/swaggerApis.ts | 8 ++++---- packages/nocodb/src/lib/meta/api/swagger/swaggerHtml.ts | 6 +++++- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/packages/nocodb/src/lib/meta/api/swagger/redocHtml.ts b/packages/nocodb/src/lib/meta/api/swagger/redocHtml.ts index 31a0cd782c..cc2682fdac 100644 --- a/packages/nocodb/src/lib/meta/api/swagger/redocHtml.ts +++ b/packages/nocodb/src/lib/meta/api/swagger/redocHtml.ts @@ -1,4 +1,8 @@ -export default (ncSiteUrl: string): string => ` +export default ({ + ncSiteUrl, +}: { + ncSiteUrl: string; +}): string => ` NocoDB API Documentation diff --git a/packages/nocodb/src/lib/meta/api/swagger/swaggerApis.ts b/packages/nocodb/src/lib/meta/api/swagger/swaggerApis.ts index 0692ba5f2c..c8cb637ba1 100644 --- a/packages/nocodb/src/lib/meta/api/swagger/swaggerApis.ts +++ b/packages/nocodb/src/lib/meta/api/swagger/swaggerApis.ts @@ -38,12 +38,12 @@ async function swaggerJson(req, res) { res.json(swagger); } -function swaggerHtml(req, res) { - res.send(getSwaggerHtml(req.ncSiteUrl)); +function swaggerHtml(_, res) { + res.send(getSwaggerHtml({ ncSiteUrl: process.env.NC_PUBLIC_URL || '' })); } -function redocHtml(req, res) { - res.send(getRedocHtml(req.ncSiteUrl)); +function redocHtml(_, res) { + res.send(getRedocHtml({ ncSiteUrl: process.env.NC_PUBLIC_URL || '' })); } const router = Router({ mergeParams: true }); diff --git a/packages/nocodb/src/lib/meta/api/swagger/swaggerHtml.ts b/packages/nocodb/src/lib/meta/api/swagger/swaggerHtml.ts index 83c090c26a..27f6bef73d 100644 --- a/packages/nocodb/src/lib/meta/api/swagger/swaggerHtml.ts +++ b/packages/nocodb/src/lib/meta/api/swagger/swaggerHtml.ts @@ -1,4 +1,8 @@ -export default (ncSiteUrl: string): string => ` +export default ({ + ncSiteUrl, +}: { + ncSiteUrl: string; +}): string => ` NocoDB : API Docs