2024-10-13 14:50:07 -04:00
|
|
|
import { verifySession } from "@app/lib/auth/verifySession";
|
2024-10-19 16:37:40 -04:00
|
|
|
import Link from "next/link";
|
2024-10-06 18:08:26 -04:00
|
|
|
import { redirect } from "next/navigation";
|
2024-11-03 13:57:51 -05:00
|
|
|
import { cache } from "react";
|
2024-11-23 17:56:21 -05:00
|
|
|
import DashboardLoginForm from "./DashboardLoginForm";
|
2024-11-03 13:57:51 -05:00
|
|
|
|
2024-11-23 17:56:21 -05:00
|
|
|
export const dynamic = "force-dynamic";
|
2024-10-06 09:55:45 -04:00
|
|
|
|
2024-11-02 23:46:08 -04:00
|
|
|
export default async function Page(props: {
|
|
|
|
searchParams: Promise<{ [key: string]: string | string[] | undefined }>;
|
|
|
|
}) {
|
2024-10-23 13:30:23 -04:00
|
|
|
const searchParams = await props.searchParams;
|
2024-11-03 13:57:51 -05:00
|
|
|
const getUser = cache(verifySession);
|
|
|
|
const user = await getUser();
|
2024-10-06 09:55:45 -04:00
|
|
|
|
2024-10-06 18:08:26 -04:00
|
|
|
if (user) {
|
|
|
|
redirect("/");
|
2024-10-06 09:55:45 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
2024-10-06 18:08:26 -04:00
|
|
|
<>
|
2024-11-23 17:56:21 -05:00
|
|
|
<DashboardLoginForm redirect={searchParams.redirect as string} />
|
2024-10-19 16:37:40 -04:00
|
|
|
|
|
|
|
<p className="text-center text-muted-foreground mt-4">
|
|
|
|
Don't have an account?{" "}
|
2024-11-02 23:46:08 -04:00
|
|
|
<Link
|
|
|
|
href={
|
|
|
|
!searchParams.redirect
|
|
|
|
? `/auth/signup`
|
|
|
|
: `/auth/signup?redirect=${searchParams.redirect}`
|
|
|
|
}
|
|
|
|
className="underline"
|
|
|
|
>
|
2024-10-19 16:37:40 -04:00
|
|
|
Sign up
|
|
|
|
</Link>
|
|
|
|
</p>
|
2024-10-06 18:08:26 -04:00
|
|
|
</>
|
2024-10-06 09:55:45 -04:00
|
|
|
);
|
|
|
|
}
|