Fix login
This commit is contained in:
parent
5744f56ff6
commit
972bfa64ec
1 changed files with 2 additions and 7 deletions
|
|
@ -6,7 +6,7 @@ import { signIn } from 'next-auth/react'
|
||||||
import { cn } from '@/lib/utils'
|
import { cn } from '@/lib/utils'
|
||||||
import { Button, type ButtonProps } from '@/components/ui/button'
|
import { Button, type ButtonProps } from '@/components/ui/button'
|
||||||
import { IconGitHub, IconSpinner } from '@/components/ui/icons'
|
import { IconGitHub, IconSpinner } from '@/components/ui/icons'
|
||||||
import { useSearchParams } from 'next/navigation'
|
|
||||||
interface LoginButtonProps extends ButtonProps {
|
interface LoginButtonProps extends ButtonProps {
|
||||||
showGithubIcon?: boolean
|
showGithubIcon?: boolean
|
||||||
text?: string
|
text?: string
|
||||||
|
|
@ -19,18 +19,13 @@ export function LoginButton({
|
||||||
...props
|
...props
|
||||||
}: LoginButtonProps) {
|
}: LoginButtonProps) {
|
||||||
const [isLoading, setIsLoading] = React.useState(false)
|
const [isLoading, setIsLoading] = React.useState(false)
|
||||||
const searchParams = useSearchParams()
|
|
||||||
const next = searchParams.get('next') || ''
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Button
|
<Button
|
||||||
variant="outline"
|
variant="outline"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setIsLoading(true)
|
setIsLoading(true)
|
||||||
signIn('github', {
|
signIn('github')
|
||||||
callbackUrl: `${window.location.origin}${next}`,
|
|
||||||
redirect: true
|
|
||||||
})
|
|
||||||
}}
|
}}
|
||||||
disabled={isLoading}
|
disabled={isLoading}
|
||||||
className={cn(className)}
|
className={cn(className)}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue