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

Function acceptInvitation

web/src/app/invites/[token]/page.tsx:60–91  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

58 }
59
60 const acceptInvitation = async () => {
61 if (!session) {
62 router.push(
63 `/login?callbackUrl=${encodeURIComponent(window.location.href)}`,
64 )
65 return
66 }
67
68 setAccepting(true)
69 setError(null)
70
71 try {
72 const response = await fetch(`/api/invites/${token}`, {
73 method: 'POST',
74 })
75 const data = await response.json()
76
77 if (!response.ok) {
78 setError(data.error || 'Failed to accept invitation')
79 return
80 }
81
82 setSuccess(true)
83 setTimeout(() => {
84 router.push(`/orgs/${data.organization.slug}`)
85 }, 2000)
86 } catch (error) {
87 setError('Failed to accept invitation')
88 } finally {
89 setAccepting(false)
90 }
91 }
92
93 if (loading) {
94 return (

Callers

nothing calls this directly

Calls 3

setErrorFunction · 0.85
setTimeoutFunction · 0.85
fetchFunction · 0.50

Tested by

no test coverage detected