feat: add auth pages

This commit is contained in:
2026-05-21 04:44:20 +07:00
parent d97dcc8838
commit 74526990f2
7 changed files with 222 additions and 3 deletions
+15
View File
@@ -1,4 +1,19 @@
import Home from "~/components/home";
import type { Route } from "./+types/_index";
import { auth } from "../../lib/auth";
import { redirect } from "react-router";
export async function loader({ request }: Route.LoaderArgs) {
const session = await auth.api.getSession({
headers: request.headers,
});
if (!session) {
throw redirect("/log-in");
}
return { session };
}
export default function HomePage() {
return <Home />;
+20
View File
@@ -0,0 +1,20 @@
import { redirect } from "react-router";
import type { Route } from "./+types/log-in";
import { auth } from "../../lib/auth";
import Login from "~/components/login";
export async function loader({ request }: Route.LoaderArgs) {
const session = await auth.api.getSession({
headers: request.headers,
});
if (session) {
throw redirect("/");
}
return null;
}
export default function LogInPage() {
return <Login />;
}
+20
View File
@@ -0,0 +1,20 @@
import { redirect } from "react-router";
import SignUp from "~/components/signup";
import type { Route } from "../+types/root";
import { auth } from "../../lib/auth";
export async function loader({ request }: Route.LoaderArgs) {
const session = await auth.api.getSession({
headers: request.headers,
});
if (session) {
throw redirect("/");
}
return null;
}
export default function SignUpPage() {
return <SignUp />;
}