()
| 40 | }, [token]) |
| 41 | |
| 42 | const fetchInvitation = async () => { |
| 43 | try { |
| 44 | const response = await fetch(`/api/invites/${token}`) |
| 45 | const data = await response.json() |
| 46 | |
| 47 | if (!response.ok) { |
| 48 | setError(data.error || 'Failed to load invitation') |
| 49 | return |
| 50 | } |
| 51 | |
| 52 | setInvitation(data.invitation) |
| 53 | } catch (error) { |
| 54 | setError('Failed to load invitation') |
| 55 | } finally { |
| 56 | setLoading(false) |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | const acceptInvitation = async () => { |
| 61 | if (!session) { |
no test coverage detected