Commit 72de8abe authored by isstuev's avatar isstuev

no stats endpoint -- no stats page

parent f8eeafb7
......@@ -154,7 +154,12 @@ export default function useNavItems(): ReturnType {
icon: appsIcon,
isActive: pathname.startsWith('/app'),
} : null,
{ text: 'Charts & stats', nextRoute: { pathname: '/stats' as const }, icon: statsIcon, isActive: pathname === '/stats' },
appConfig.statsApi.endpoint ? {
text: 'Charts & stats',
nextRoute: { pathname: '/stats' as const },
icon: statsIcon,
isActive: pathname === '/stats',
} : null,
{
text: 'API',
icon: apiDocsIcon,
......
import type { NextPage } from 'next';
import type { NextPage, GetServerSideProps } from 'next';
import Head from 'next/head';
import React from 'react';
import appConfig from 'configs/app/config';
import type { Props } from 'lib/next/getServerSideProps';
import { getServerSideProps as getServerSidePropsBase } from 'lib/next/getServerSideProps';
import Stats from '../ui/pages/Stats';
......@@ -17,4 +19,12 @@ const StatsPage: NextPage = () => {
export default StatsPage;
export { getServerSideProps } from 'lib/next/getServerSideProps';
export const getServerSideProps: GetServerSideProps<Props> = async(args) => {
if (!appConfig.statsApi.endpoint) {
return {
notFound: true,
};
}
return getServerSidePropsBase(args);
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment