From b53a425d53fddfed7274c47eb24d88101cd70ea8 Mon Sep 17 00:00:00 2001 From: tom Date: Thu, 1 Aug 2024 14:25:11 +0200 Subject: [PATCH] return 404 for graphIQl page if the features is disabled --- nextjs/getServerSideProps.ts | 10 ++++++++++ pages/graphiql.tsx | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/nextjs/getServerSideProps.ts b/nextjs/getServerSideProps.ts index 63103ae355..05733b177b 100644 --- a/nextjs/getServerSideProps.ts +++ b/nextjs/getServerSideProps.ts @@ -144,6 +144,16 @@ export const apiDocs: GetServerSideProps = async(context) => { return base(context); }; +export const graphIQl: GetServerSideProps = async(context) => { + if (!config.features.graphqlApiDocs.isEnabled) { + return { + notFound: true, + }; + } + + return base(context); +}; + export const csvExport: GetServerSideProps = async(context) => { if (!config.features.csvExport.isEnabled) { return { diff --git a/pages/graphiql.tsx b/pages/graphiql.tsx index 2521af804a..8bcff9cf93 100644 --- a/pages/graphiql.tsx +++ b/pages/graphiql.tsx @@ -27,4 +27,4 @@ const Page: NextPage = () => { export default Page; -export { base as getServerSideProps } from 'nextjs/getServerSideProps'; +export { graphIQl as getServerSideProps } from 'nextjs/getServerSideProps';