Skip to content

Commit

Permalink
return 404 for graphIQl page if the features is disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
tom2drum committed Aug 1, 2024
1 parent c60ce02 commit b53a425
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions nextjs/getServerSideProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,16 @@ export const apiDocs: GetServerSideProps<Props> = async(context) => {
return base(context);
};

export const graphIQl: GetServerSideProps<Props> = async(context) => {
if (!config.features.graphqlApiDocs.isEnabled) {
return {
notFound: true,
};
}

return base(context);
};

export const csvExport: GetServerSideProps<Props> = async(context) => {
if (!config.features.csvExport.isEnabled) {
return {
Expand Down
2 changes: 1 addition & 1 deletion pages/graphiql.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ const Page: NextPage = () => {

export default Page;

export { base as getServerSideProps } from 'nextjs/getServerSideProps';
export { graphIQl as getServerSideProps } from 'nextjs/getServerSideProps';

0 comments on commit b53a425

Please sign in to comment.