32 lines
1.0 KiB
TypeScript
Executable File
32 lines
1.0 KiB
TypeScript
Executable File
import LoginForm from "@/components/auth/LoginForm";
|
|
|
|
type LoginPageProps = {
|
|
searchParams: Promise<{
|
|
redirectTo?: string | string[];
|
|
role?: string | string[];
|
|
forgot?: string | string[];
|
|
switchUser?: string | string[];
|
|
}>;
|
|
};
|
|
|
|
export default async function LoginPage({ searchParams }: LoginPageProps) {
|
|
const params = await searchParams;
|
|
const redirectValue = params.redirectTo;
|
|
const redirectTo = Array.isArray(redirectValue) ? redirectValue[0] : redirectValue;
|
|
const roleValue = params.role;
|
|
const role = Array.isArray(roleValue) ? roleValue[0] : roleValue;
|
|
const forgotValue = params.forgot;
|
|
const forgot = Array.isArray(forgotValue) ? forgotValue[0] : forgotValue;
|
|
const switchUserValue = params.switchUser;
|
|
const switchUser = Array.isArray(switchUserValue) ? switchUserValue[0] : switchUserValue;
|
|
|
|
return (
|
|
<LoginForm
|
|
redirectTo={redirectTo ?? "/courses"}
|
|
role={role}
|
|
showForgot={forgot === "1"}
|
|
skipAuthedRedirect={switchUser === "1"}
|
|
/>
|
|
);
|
|
}
|