Added /users/me route, and handling auth in frontend
This commit is contained in:
@@ -1,8 +1,15 @@
|
||||
import { GalleryVerticalEnd } from "lucide-react";
|
||||
import Image from "next/image";
|
||||
|
||||
import { LoginForm } from "@/components/login-form";
|
||||
import { cookies } from "next/headers";
|
||||
import { redirect } from "next/navigation";
|
||||
|
||||
export default async function LoginPage() {
|
||||
const cookiesObj = await cookies();
|
||||
const token = cookiesObj.get("auth_token")?.value;
|
||||
|
||||
if (token) redirect("/dashboard");
|
||||
|
||||
export default function LoginPage() {
|
||||
return (
|
||||
<div className="grid min-h-svh lg:grid-cols-2">
|
||||
<div className="flex flex-col gap-4 p-6 md:p-10">
|
||||
@@ -13,7 +20,9 @@ export default function LoginPage() {
|
||||
</div>
|
||||
</div>
|
||||
<div className="relative hidden bg-muted lg:block">
|
||||
<img
|
||||
<Image
|
||||
width={20}
|
||||
height={20}
|
||||
src="/placeholder.svg"
|
||||
alt="Image"
|
||||
className="absolute inset-0 h-full w-full object-cover dark:brightness-[0.2] dark:grayscale"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { Metadata } from "next";
|
||||
import { Geist, Geist_Mono } from "next/font/google";
|
||||
import "@/app/globals.css";
|
||||
import { SWRConfig } from "swr";
|
||||
import SWRLayout from "@/components/layouts/swr-layout";
|
||||
|
||||
const geistSans = Geist({
|
||||
variable: "--font-geist-sans",
|
||||
@@ -24,19 +24,12 @@ export default function RootLayout({
|
||||
children: React.ReactNode;
|
||||
}>) {
|
||||
return (
|
||||
//<SWRConfig
|
||||
// value={{
|
||||
// fetcher: (url: string) => fetch(url).then((res) => res.json()),
|
||||
// revalidateOnFocus: false,
|
||||
// }}
|
||||
//>
|
||||
<html lang="fr">
|
||||
<body
|
||||
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
|
||||
>
|
||||
{children}
|
||||
</body>
|
||||
</html>
|
||||
//</SWRConfig>
|
||||
<html lang="fr">
|
||||
<body
|
||||
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
|
||||
>
|
||||
<SWRLayout>{children}</SWRLayout>
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user