Work on passing all env variables on server side.

This commit is contained in:
charlesgauthereau
2025-11-03 18:54:16 +01:00
parent 82559b49bd
commit bcbd6bbea1
9 changed files with 55 additions and 49 deletions
-2
View File
@@ -1,7 +1,5 @@
"use client"
import React, {useEffect, useState} from "react";
import {LayoutAdmin} from "@/components/layout";
import Image from "next/image";
import {env} from "@/env.mjs";
import {useTheme} from "next-themes";
import {useSession} from "@/lib/auth/auth-client";
+8 -23
View File
@@ -1,32 +1,17 @@
"use client"
import {useEffect, useRef, useState} from "react";
import {useSearchParams} from "next/navigation";
import {notFound} from "next/navigation";
import {env} from "@/env.mjs";
import {LoginForm} from "@/components/wrappers/auth/login/login-form/login-form";
import {toast} from "sonner";
export default function SignInPage(props: {
searchParams: Promise<{ callbackUrl: string | undefined }>
}) {
export default async function SignInPage() {
const [urlParams, setUrlParams] = useState<URLSearchParams>();
useEffect(() => {
const urlParams = new URLSearchParams(window.location.search);
setUrlParams(urlParams);
const error = urlParams.get("error");
console.log(urlParams.get("redirect"));
if (error?.includes("pending")) {
toast.error("Your account is not active.");
urlParams.delete("error");
window.history.replaceState({}, document.title, window.location.pathname + "?" + urlParams.toString());
}
}, []);
const authGoogleEnabled = env.AUTH_GOOGLE_METHOD;
if (!authGoogleEnabled) {
notFound()
}
return (
<div className="mx-auto grid w-full gap-6">
<LoginForm/>
<LoginForm authGoogleEnabled={authGoogleEnabled}/>
</div>
)
}