Init
This commit is contained in:
29
src/components/auth/sign-in-button.tsx
Normal file
29
src/components/auth/sign-in-button.tsx
Normal file
@@ -0,0 +1,29 @@
|
||||
"use client"
|
||||
|
||||
import { signIn, useSession } from "@/lib/auth-client"
|
||||
import { Button } from "@/components/ui/button"
|
||||
|
||||
export function SignInButton() {
|
||||
const { data: session, isPending } = useSession()
|
||||
|
||||
if (isPending) {
|
||||
return <Button disabled>Loading...</Button>
|
||||
}
|
||||
|
||||
if (session) {
|
||||
return null
|
||||
}
|
||||
|
||||
return (
|
||||
<Button
|
||||
onClick={async () => {
|
||||
await signIn.social({
|
||||
provider: "google",
|
||||
callbackURL: "/dashboard",
|
||||
})
|
||||
}}
|
||||
>
|
||||
Sign in with Google
|
||||
</Button>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user