From 81b57dcb0f48c1f0a166f6cb2fdc3a61b74c81f9 Mon Sep 17 00:00:00 2001 From: Pjaijai Date: Mon, 25 Dec 2023 21:43:34 -0500 Subject: [PATCH 1/4] feat: create not found page --- client/app/not-found.tsx | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 client/app/not-found.tsx diff --git a/client/app/not-found.tsx b/client/app/not-found.tsx new file mode 100644 index 00000000..fb6c0263 --- /dev/null +++ b/client/app/not-found.tsx @@ -0,0 +1,23 @@ +"use client" + +import { useRouter } from "next/navigation" + +import { Button } from "@/components/ui/button" + +const NotFound = () => { + const router = useRouter() + const handleClick = () => { + router.back() + } + return ( +
+ πŸ₯²πŸ˜’ +
{"404 Not Found"}
+ +
+ ) +} + +export default NotFound From dbe9873eabba7494665caeb270045fcb35115747 Mon Sep 17 00:00:00 2001 From: Pjaijai Date: Mon, 25 Dec 2023 21:44:22 -0500 Subject: [PATCH 2/4] feat: return not found in sign up page if user already signed in --- .../auth/components/templates/sign-up/template.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/client/modules/auth/components/templates/sign-up/template.tsx b/client/modules/auth/components/templates/sign-up/template.tsx index c92da986..e7075e24 100644 --- a/client/modules/auth/components/templates/sign-up/template.tsx +++ b/client/modules/auth/components/templates/sign-up/template.tsx @@ -1,7 +1,15 @@ +"use client" + import React from "react" +import { notFound } from "next/navigation" import SignUpForm from "@/modules/auth/components/forms/sign-up" +import useUserStore from "@/hooks/state/user/store" + const SignUpPageTemplate = () => { + const isUserSignIn = useUserStore((state) => state.isSignIn) + + if (isUserSignIn) throw notFound() return (
From 87eabe1c58486b14dbeb2695ae3c03a540d59267 Mon Sep 17 00:00:00 2001 From: Pjaijai Date: Mon, 25 Dec 2023 22:35:41 -0500 Subject: [PATCH 3/4] chore: replace throw with replace --- client/modules/auth/components/templates/sign-up/template.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/modules/auth/components/templates/sign-up/template.tsx b/client/modules/auth/components/templates/sign-up/template.tsx index e7075e24..34a21907 100644 --- a/client/modules/auth/components/templates/sign-up/template.tsx +++ b/client/modules/auth/components/templates/sign-up/template.tsx @@ -9,7 +9,7 @@ import useUserStore from "@/hooks/state/user/store" const SignUpPageTemplate = () => { const isUserSignIn = useUserStore((state) => state.isSignIn) - if (isUserSignIn) throw notFound() + if (isUserSignIn) return notFound() return (
From cdd3958aa752475c41d64de73d40e497bc4e18e0 Mon Sep 17 00:00:00 2001 From: Pjaijai Date: Tue, 26 Dec 2023 15:27:50 -0500 Subject: [PATCH 4/4] fix: new not found page --- client/app/[locale]/not-found.tsx | 24 ++++++++++++++++++------ client/app/not-found.tsx | 23 ----------------------- 2 files changed, 18 insertions(+), 29 deletions(-) delete mode 100644 client/app/not-found.tsx diff --git a/client/app/[locale]/not-found.tsx b/client/app/[locale]/not-found.tsx index 2c3d328c..fb6c0263 100644 --- a/client/app/[locale]/not-found.tsx +++ b/client/app/[locale]/not-found.tsx @@ -1,11 +1,23 @@ -import Link from "next/link" +"use client" -export default function NotFound() { +import { useRouter } from "next/navigation" + +import { Button } from "@/components/ui/button" + +const NotFound = () => { + const router = useRouter() + const handleClick = () => { + router.back() + } return ( -
-

Not Found

-

Could not find requested resource

- Return Home +
+ πŸ₯²πŸ˜’ +
{"404 Not Found"}
+
) } + +export default NotFound diff --git a/client/app/not-found.tsx b/client/app/not-found.tsx deleted file mode 100644 index fb6c0263..00000000 --- a/client/app/not-found.tsx +++ /dev/null @@ -1,23 +0,0 @@ -"use client" - -import { useRouter } from "next/navigation" - -import { Button } from "@/components/ui/button" - -const NotFound = () => { - const router = useRouter() - const handleClick = () => { - router.back() - } - return ( -
- πŸ₯²πŸ˜’ -
{"404 Not Found"}
- -
- ) -} - -export default NotFound