Skip to content

Commit

Permalink
Merge pull request #6 from apeunit/feat/add-not-found-page
Browse files Browse the repository at this point in the history
feat: adds not-found page
  • Loading branch information
chrisostome01 authored Jun 7, 2024
2 parents 5954faf + c280fc2 commit 373bcbb
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 11 deletions.
6 changes: 3 additions & 3 deletions hooks/auth.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import useSWR from "swr"
import axios from "../lib/axios"
import { useEffect } from "react"
import { User } from "@/types"
import { useEffect } from "react"
import { useNavigate, useParams } from "react-router-dom"
import useSWR from "swr"
import axios from "../lib/axios"

type UseAuthProps = {
middleware?: "auth" | "guest"
Expand Down
18 changes: 13 additions & 5 deletions views/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ import DashboardHeader from "./app/headers/DashboardHeader"
import AppLayout from "./app/layout"
import Login from "./auth/login/page"
import AuthLayout from "./auth/layout"
import NotFoundPage from "./not-found"

const App = () => {
return (
<BrowserRouter>
<Routes>

<Route
<Route
path="/login"
element={
<RootLayout>
Expand Down Expand Up @@ -52,14 +52,22 @@ const App = () => {
path="/dashboard"
element={
<RootLayout>
<AppLayout header={<DashboardHeader><></></DashboardHeader>} >
<Dashboard />
<AppLayout
header={
<DashboardHeader>
<></>
</DashboardHeader>
}
>
<Dashboard />
</AppLayout>
</RootLayout>
}
/>


<Route path="*" element={
<NotFoundPage />
} />
{/* </RootLayout> */}
</Routes>
</BrowserRouter>
Expand Down
3 changes: 1 addition & 2 deletions views/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ const Home = () => {
const navigate = useNavigate()

useLayoutEffect(() => {
console.log({ user })
// if (user) return navigate("/dashboard")
if (user) return navigate("/dashboard")
}, [user])

return null
Expand Down
2 changes: 1 addition & 1 deletion views/not-found.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Heading, Link, Text } from "@radix-ui/themes";
import AuthCard from "./(auth)/AuthCard/AuthCard";
import AuthCard from "./auth/AuthCard/AuthCard";

import styles from "./NotFound.module.css";

Expand Down

0 comments on commit 373bcbb

Please sign in to comment.