feat: 404 on non-existent dashboards
This commit is contained in:
parent
986f7ab888
commit
115bd30708
|
@ -1,4 +1,5 @@
|
|||
import { GetServerSideProps, NextPage } from "next";
|
||||
import Error from "next/error";
|
||||
import Link from "next/link";
|
||||
|
||||
import { DashboardItem } from "../../../backend/dashboards";
|
||||
|
@ -32,6 +33,10 @@ export const getServerSideProps: GetServerSideProps<Props> = async (
|
|||
platformsConfig
|
||||
);
|
||||
|
||||
if (!dashboardItem) {
|
||||
context.res.statusCode = 404;
|
||||
}
|
||||
|
||||
return {
|
||||
props: {
|
||||
dashboardForecasts: frontendDashboardForecasts,
|
||||
|
@ -89,7 +94,9 @@ const ViewDashboardPage: NextPage<Props> = ({
|
|||
<div className="flex flex-col my-8 space-y-8">
|
||||
{dashboardItem ? (
|
||||
<DashboardMetadata dashboardItem={dashboardItem} />
|
||||
) : null}
|
||||
) : (
|
||||
<Error statusCode={404} />
|
||||
)}
|
||||
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
|
||||
<DisplayForecasts
|
||||
|
|
Loading…
Reference in New Issue
Block a user