diff --git a/apps/web/app/layout.tsx b/apps/web/app/layout.tsx
index 86560032..53c306bc 100644
--- a/apps/web/app/layout.tsx
+++ b/apps/web/app/layout.tsx
@@ -3,7 +3,7 @@ import { Inter } from "next/font/google";
import "./globals.css";
import { NavBar } from "../components/nav-bar";
import { Toaster } from "@/components/ui/toaster";
-import Script from "next/script";
+import Scripts from "./scripts";
const inter = Inter({ subsets: ["latin"] });
@@ -17,35 +17,9 @@ export default async function RootLayout({
}: {
children: React.ReactNode;
}) {
- const response = await fetch(`${process.env.AUTH_URL}/config`);
- const result = await response.json();
return (
-
-
-
-
-
-
+
@@ -53,6 +27,7 @@ export default async function RootLayout({
{/* */}
+
);
diff --git a/apps/web/app/login/page.tsx b/apps/web/app/login/page.tsx
index 49cea5b4..5e42d0fe 100644
--- a/apps/web/app/login/page.tsx
+++ b/apps/web/app/login/page.tsx
@@ -1,7 +1,15 @@
+import { auth } from "@/auth";
import LoginForm from "@/components/login-form";
import Link from "next/link";
+import { redirect } from "next/navigation";
+
+export default async function LoginPage() {
+ const session = await auth();
+
+ if (session) {
+ redirect("/");
+ }
-export default function LoginPage() {
return (
Sign in
diff --git a/apps/web/app/scripts.tsx b/apps/web/app/scripts.tsx
new file mode 100644
index 00000000..4d83ce0e
--- /dev/null
+++ b/apps/web/app/scripts.tsx
@@ -0,0 +1,50 @@
+"use client";
+
+import Script from "next/script";
+import { useEffect, useState } from "react";
+
+export default function Scripts() {
+ const [result, setResult] = useState>();
+
+ useEffect(() => {
+ async function fetchConfig() {
+ const response = await fetch(`/config`);
+ const result = await response.json();
+ setResult(result);
+ }
+
+ fetchConfig();
+ });
+
+ if (!result) {
+ return null;
+ }
+
+ return (
+ <>
+
+
+
+
+ >
+ );
+}