-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
page.tsx
44 lines (38 loc) · 1.01 KB
/
page.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
"use client";
import { useState } from "react";
import { cn } from "@/utils/cn";
import { signIn } from "next-auth/react";
import { Button } from "@/ui/button";
import { toast } from "sonner";
import { GithubIcon } from "lucide-react";
const Page = () => {
const [loading, setLoading] = useState(false);
const handleLogin = async (provider: string) => {
setLoading(true);
try {
await signIn(provider, {
callbackUrl: `/dashboard`,
});
} catch (error) {
toast.error("Unable to log in. Please try again later.");
setLoading(false);
}
};
return (
<div
className={cn(
"flex min-h-screen flex-col items-center justify-center animate-in fade-in-5"
)}
>
<h2 className="mb-2 text-2xl">Iniciar sesión</h2>
<Button
icon={<GithubIcon width={20} />}
onClick={() => handleLogin("github")}
loadingstatus={loading}
>
<span>Continuar con Github</span>
</Button>
</div>
);
};
export default Page;