created simple auth system using betterauth
This commit is contained in:
12
src/app/admin/page.tsx
Normal file
12
src/app/admin/page.tsx
Normal file
@@ -0,0 +1,12 @@
|
||||
import AuthRedirect from "@/components/AuthRedirect";
|
||||
|
||||
export default function AdminPage() {
|
||||
|
||||
return (
|
||||
<div>
|
||||
<AuthRedirect />
|
||||
<h1>Admin Dashboard</h1>
|
||||
<p>Welcome to the admin dashboard. Here you can manage the application.</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
3
src/app/api/auth/[...all]/route.ts
Normal file
3
src/app/api/auth/[...all]/route.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
import { auth } from "@/lib/auth"; // path to your auth file
|
||||
import { toNextJsHandler } from "better-auth/next-js";
|
||||
export const { POST, GET } = toNextJsHandler(auth);
|
||||
@@ -1,3 +1,7 @@
|
||||
import './globals.css';
|
||||
import { Header } from '@/components/Header';
|
||||
import { Footer } from '@/components/Footer';
|
||||
|
||||
export default function RootLayout({
|
||||
children,
|
||||
}: {
|
||||
@@ -5,7 +9,13 @@ export default function RootLayout({
|
||||
}) {
|
||||
return (
|
||||
<html>
|
||||
<body>{children}</body>
|
||||
<body className="flex flex-col min-h-screen">
|
||||
<Header />
|
||||
<main className="flex-grow mt-4 mb-4 mr-8 ml-8">
|
||||
{children}
|
||||
</main>
|
||||
<Footer />
|
||||
</body>
|
||||
</html>
|
||||
)
|
||||
}
|
||||
@@ -1,3 +1,5 @@
|
||||
"use client";
|
||||
|
||||
export default function Page() {
|
||||
return <h1>Hello Next.js!</h1>
|
||||
}
|
||||
5
src/app/user/sign-in/page.tsx
Normal file
5
src/app/user/sign-in/page.tsx
Normal file
@@ -0,0 +1,5 @@
|
||||
import { AuthForm } from '@/components/AuthForm';
|
||||
|
||||
export default function SignInPage() {
|
||||
return <AuthForm />;
|
||||
}
|
||||
Reference in New Issue
Block a user