[rewrite] Added first steps for authentication

This commit is contained in:
Thastertyn committed 2025-02-21 16:51:37 +01:00
1 parent 073f01d070
commit a9c85cefe1
5 files changed
+170 -25

No files matched your search

@@ -1,6 +1,6 @@
import { createFileRoute } from "@tanstack/react-router";
import Dashboard from "@/pages/dashboard";
export const Route = createFileRoute("/_authenticated/")({
export const Route = createFileRoute("/_authenticated/dashboard/")({
component: Dashboard
});
+11 -1
View File
@@ -1,5 +1,5 @@
import Cookies from "js-cookie";
import { createFileRoute, Outlet } from "@tanstack/react-router";
import { createFileRoute, Outlet, redirect } from "@tanstack/react-router";
import { cn } from "@/lib/utils";
import { SearchProvider } from "@/context/search-context";
import { SidebarProvider } from "@/components/ui/sidebar";
@@ -7,6 +7,16 @@ import { AppSidebar } from "@/components/layout/app-sidebar";
import SkipToMain from "@/components/skip-to-main";
export const Route = createFileRoute("/_authenticated")({
beforeLoad: async ({ location }) => {
if (true) {
throw redirect({
to: "/sign-in",
search: {
redirect: location.href
}
});
}
},
component: RouteComponent
});
+6
View File
@@ -0,0 +1,6 @@
import { createFileRoute } from "@tanstack/react-router";
import MainPage from "@/pages/home";
export const Route = createFileRoute("/")({
component: MainPage
});