diff --git a/app/dashboard/Dashboard.tsx b/app/dashboard/Dashboard.tsx index 2c47ce0..e2648a7 100644 --- a/app/dashboard/Dashboard.tsx +++ b/app/dashboard/Dashboard.tsx @@ -14,7 +14,7 @@ import { SidebarTrigger, } from "@/components/ui/sidebar" -export default function Page() { +export default function Dashboard() { return ( diff --git a/app/dashboard/applications/Applications.tsx b/app/dashboard/applications/Applications.tsx new file mode 100644 index 0000000..8923a6d --- /dev/null +++ b/app/dashboard/applications/Applications.tsx @@ -0,0 +1,51 @@ +import { AppSidebar } from "@/components/app-sidebar" +import { + Breadcrumb, + BreadcrumbItem, + BreadcrumbLink, + BreadcrumbList, + BreadcrumbPage, + BreadcrumbSeparator, +} from "@/components/ui/breadcrumb" +import { Separator } from "@/components/ui/separator" +import { + SidebarInset, + SidebarProvider, + SidebarTrigger, +} from "@/components/ui/sidebar" + +export default function Dashboard() { + return ( + + + +
+
+ + + + + + + / + + + + + Customization + + + + Applications + + + +
+
+
+ Test +
+
+
+ ) +} diff --git a/app/dashboard/applications/page.tsx b/app/dashboard/applications/page.tsx new file mode 100644 index 0000000..f45addb --- /dev/null +++ b/app/dashboard/applications/page.tsx @@ -0,0 +1,47 @@ +"use client"; + +import { useEffect, useState } from "react"; +import Cookies from "js-cookie"; +import { useRouter } from "next/navigation"; +import Applications from "./Applications" +import axios from "axios"; + +export default function DashboardPage() { + const router = useRouter(); + const [isAuthChecked, setIsAuthChecked] = useState(false); + const [isValid, setIsValid] = useState(false); + + useEffect(() => { + const token = Cookies.get("token"); + if (!token) { + router.push("/"); + } else { + const checkToken = async () => { + try { + const response = await axios.post("/api/auth/validate", { + token: token, + }); + + if (response.status === 200) { + setIsValid(true); + } + } catch (error: any) { + Cookies.remove("token"); + router.push("/"); + } + } + checkToken(); + } + setIsAuthChecked(true); + }, [router]); + + if (!isAuthChecked) { + return ( +
+ +
+ ) + } + + return isValid ? : null; +} \ No newline at end of file