mirror of
https://github.com/sourcebot-dev/sourcebot.git
synced 2025-12-12 12:25:22 +00:00
improved fix
This commit is contained in:
parent
2111a77a5c
commit
331a41888e
2 changed files with 14 additions and 9 deletions
|
|
@ -13,13 +13,14 @@ import googleLogo from "@/public/google.svg";
|
||||||
import Image from "next/image";
|
import Image from "next/image";
|
||||||
import { signIn } from "next-auth/react";
|
import { signIn } from "next-auth/react";
|
||||||
import { useCallback, useMemo } from "react";
|
import { useCallback, useMemo } from "react";
|
||||||
import { useNonEmptyQueryParam } from "@/hooks/useNonEmptyQueryParam";
|
|
||||||
import { verifyCredentialsRequestSchema } from "@/lib/schemas";
|
import { verifyCredentialsRequestSchema } from "@/lib/schemas";
|
||||||
|
|
||||||
export const LoginForm = () => {
|
interface LoginFormProps {
|
||||||
const callbackUrl = useNonEmptyQueryParam("callbackUrl");
|
callbackUrl?: string;
|
||||||
const error = useNonEmptyQueryParam("error");
|
error?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const LoginForm = ({ callbackUrl, error }: LoginFormProps) => {
|
||||||
const form = useForm<z.infer<typeof verifyCredentialsRequestSchema>>({
|
const form = useForm<z.infer<typeof verifyCredentialsRequestSchema>>({
|
||||||
resolver: zodResolver(verifyCredentialsRequestSchema),
|
resolver: zodResolver(verifyCredentialsRequestSchema),
|
||||||
defaultValues: {
|
defaultValues: {
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,16 @@
|
||||||
import { LoginForm } from "./components/loginForm";
|
import { LoginForm } from "./components/loginForm";
|
||||||
import { Suspense } from "react";
|
|
||||||
|
|
||||||
export default async function Login() {
|
interface LoginProps {
|
||||||
|
searchParams: {
|
||||||
|
callbackUrl?: string;
|
||||||
|
error?: string;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default async function Login({ searchParams }: LoginProps) {
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col justify-center items-center h-screen">
|
<div className="flex flex-col justify-center items-center h-screen">
|
||||||
<Suspense fallback={<div>Loading...</div>}>
|
<LoginForm callbackUrl={searchParams.callbackUrl} error={searchParams.error} />
|
||||||
<LoginForm />
|
|
||||||
</Suspense>
|
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue