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