[Update] Replace redirect with notFound for 404 handling (#4596)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import "server-only";
|
||||
|
||||
import { redirect } from "next/navigation";
|
||||
import { notFound } from "next/navigation";
|
||||
import type { ChainCTAProps } from "./[chain_id]/(chainPage)/components/server/cta-card";
|
||||
import zeroGCTA from "./temp-assets/0gCTA.png";
|
||||
import zeroGBanner from "./temp-assets/0gLabsBanner.png";
|
||||
@@ -89,7 +89,7 @@ export async function getChain(
|
||||
]);
|
||||
|
||||
if (!chain.data) {
|
||||
redirect("/404");
|
||||
notFound();
|
||||
}
|
||||
return {
|
||||
...chain.data,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { getProjects } from "@/api/projects";
|
||||
import { getTeams } from "@/api/team";
|
||||
import { TabPathLinks } from "@/components/ui/tabs";
|
||||
import { redirect } from "next/navigation";
|
||||
import { notFound } from "next/navigation";
|
||||
import { TeamHeader } from "../../components/TeamHeader/TeamHeader";
|
||||
|
||||
export default async function TeamLayout(props: {
|
||||
@@ -18,8 +18,7 @@ export default async function TeamLayout(props: {
|
||||
);
|
||||
|
||||
if (!team) {
|
||||
// not a valid team, redirect back to 404
|
||||
redirect("/404");
|
||||
notFound();
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
+2
-2
@@ -11,14 +11,14 @@ export default async function Page(props: {
|
||||
const project = await getProject(team_slug, project_slug);
|
||||
|
||||
if (!project) {
|
||||
return notFound();
|
||||
notFound();
|
||||
}
|
||||
|
||||
// THIS IS A WORKAROUND - project does not have `services` info - so we fetch APIKey object.
|
||||
const apiKey = await getAPIKey(project.id);
|
||||
|
||||
if (!apiKey) {
|
||||
return notFound();
|
||||
notFound();
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
@@ -15,7 +15,7 @@ export default async function Page(props: {
|
||||
);
|
||||
|
||||
if (!project) {
|
||||
return notFound();
|
||||
notFound();
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ export default async function Page(props: {
|
||||
);
|
||||
|
||||
if (!project) {
|
||||
return notFound();
|
||||
notFound();
|
||||
}
|
||||
|
||||
const TRACKING_CATEGORY = "team/in-app-wallets";
|
||||
|
||||
@@ -15,7 +15,7 @@ export default async function Page(props: {
|
||||
);
|
||||
|
||||
if (!project) {
|
||||
return notFound();
|
||||
notFound();
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { getProjects } from "@/api/projects";
|
||||
import { getTeams } from "@/api/team";
|
||||
import { TabPathLinks } from "@/components/ui/tabs";
|
||||
import { redirect } from "next/navigation";
|
||||
import { notFound, redirect } from "next/navigation";
|
||||
import { TeamHeader } from "../../components/TeamHeader/TeamHeader";
|
||||
|
||||
export default async function TeamLayout(props: {
|
||||
@@ -14,7 +14,7 @@ export default async function TeamLayout(props: {
|
||||
|
||||
if (!team) {
|
||||
// not a valid team, redirect back to 404
|
||||
redirect("/404");
|
||||
notFound();
|
||||
}
|
||||
|
||||
const teamsAndProjects = await Promise.all(
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { getTeams } from "@/api/team";
|
||||
import { redirect } from "next/navigation";
|
||||
import { notFound, redirect } from "next/navigation";
|
||||
|
||||
export default async function TeamRootPage() {
|
||||
// get all teams, then go to the first team
|
||||
@@ -7,7 +7,7 @@ export default async function TeamRootPage() {
|
||||
|
||||
const firstTeam = teams[0];
|
||||
if (!firstTeam) {
|
||||
return redirect("/404");
|
||||
notFound();
|
||||
}
|
||||
redirect(`/team/${firstTeam.slug}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user