31 lines
772 B
TypeScript
31 lines
772 B
TypeScript
// app/login/page.tsx
|
|
import { cookies } from 'next/headers';
|
|
import { redirect } from 'next/navigation';
|
|
import Header from '../components/Header';
|
|
import LoginForm from './LoginForm';
|
|
import Footer from '../components/Footer';
|
|
|
|
export const metadata = {
|
|
title: 'Logga in',
|
|
};
|
|
|
|
export default async function LoginPage() {
|
|
const cookieStore = await cookies();
|
|
const isLoggedIn = cookieStore.get('admin_session')?.value === 'true';
|
|
|
|
if (isLoggedIn) {
|
|
redirect('/admin');
|
|
}
|
|
|
|
return (
|
|
<div className="min-h-screen flex flex-col">
|
|
<Header />
|
|
|
|
<div className="grow flex items-center justify-center bg-[#406185] p-5">
|
|
<LoginForm />
|
|
</div>
|
|
|
|
<Footer />
|
|
</div>
|
|
);
|
|
} |