()
| 202 | if (!session?.user) return |
| 203 | |
| 204 | async function fetchInvitation() { |
| 205 | setIsLoading(true) |
| 206 | try { |
| 207 | const data = await requestJson(getInvitationContract, { |
| 208 | params: { id: inviteId }, |
| 209 | query: { token: token ?? undefined }, |
| 210 | }) |
| 211 | setInvitation(data.invitation) |
| 212 | setError(null) |
| 213 | } catch (fetchError) { |
| 214 | logger.error('Error fetching invitation:', fetchError) |
| 215 | const code = |
| 216 | fetchError instanceof ApiClientError |
| 217 | ? codeFromApiClientError(fetchError) |
| 218 | : 'network-error' |
| 219 | setError(getInviteError(code)) |
| 220 | } finally { |
| 221 | setIsLoading(false) |
| 222 | } |
| 223 | } |
| 224 | |
| 225 | fetchInvitation() |
| 226 | }, [session?.user, inviteId, token]) |
no test coverage detected