YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context
Rust agentsagiaiai-memoryaudio-recordingcomputer-visionhermeshermes-agentllmlocal-ailocal-firstmachine-learningmcpmultimodalopenclawprivacyrewindscreen-recordingspeech-to-textycombinator
fix: improve invite email error handling in use-team hook
Louis Beaumont26a23fe39c48
diff --git a/apps/screenpipe-app-tauri/lib/hooks/use-team.ts b/apps/screenpipe-app-tauri/lib/hooks/use-team.tsindex 5a719319d..26dac5e06 100644--- a/apps/screenpipe-app-tauri/lib/hooks/use-team.ts+++ b/apps/screenpipe-app-tauri/lib/hooks/use-team.ts@@ -400,23 +400,31 @@ export function useTeam() {);// send email invite (calls server API)- // TODO: server endpoint POST https://screenpi.pe/api/team/invite must be created in website-screenpipe repoconst sendInviteEmail = useCallback(async (email: string) => {if (!token || !state.inviteLink || !state.team)throw new Error("no team");- const res = await fetch(`${API}/invite`, {- method: "POST",- headers: headers(),- body: JSON.stringify({- email,- team_name: state.team.name,- invite_link: state.inviteLink,- }),- });+ let res: Response;+ try {+ res = await fetch(`${API}/invite`, {+ method: "POST",+ headers: headers(),+ body: JSON.stringify({+ email,+ team_name: state.team.name,+ invite_link: state.inviteLink,+ }),+ });+ } catch {+ throw new Error("network error — could not reach server");+ }if (!res.ok) {- const err = await res.json();- throw new Error(err.error || "failed to send invite");+ let msg = "failed to send invite";+ try {+ const err = await res.json();+ msg = err.error || msg;+ } catch {}+ throw new Error(msg);}},// eslint-disable-next-line react-hooks/exhaustive-deps