MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / handleSignIn

Function handleSignIn

web/src/components/sign-in/sign-in-button.tsx:30–70  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

28 const searchParams = useSearchParams() ?? new URLSearchParams()
29
30 const handleSignIn = () => {
31 onClick?.()
32
33 startTransition(async () => {
34 const searchParamsString = searchParams.toString()
35 let callbackUrl =
36 pathname + (searchParamsString ? `?${searchParamsString}` : '')
37
38 if (pathname === '/login') {
39 const authCode = searchParams.get('auth_code')
40 if (authCode) {
41 callbackUrl = `/onboard?${searchParams.toString()}`
42 } else {
43 callbackUrl = '/'
44 }
45 }
46
47 posthog.capture(AnalyticsEvent.AUTH_LOGIN_STARTED, {
48 provider: providerName,
49 callbackUrl: callbackUrl,
50 })
51
52 try {
53 await signIn(providerName, { callbackUrl })
54 } catch (error) {
55 toast({
56 title: 'Sign in failed',
57 description:
58 'Please try again or contact support if the problem persists.',
59 })
60 return
61 }
62
63 await sleep(10000).then(() => {
64 toast({
65 title: 'Uh-oh this is taking a while...',
66 description: 'Would you mind you trying again?',
67 })
68 })
69 })
70 }
71
72 return (
73 <Button

Callers

nothing calls this directly

Calls 4

toastFunction · 0.90
sleepFunction · 0.90
captureMethod · 0.80
getMethod · 0.65

Tested by

no test coverage detected