fix(web): handle non-OK/non-JSON errors in brain connection link

This commit is contained in:
Mahesh Sanikommu 2026-06-20 02:22:34 -07:00
parent 1c4b596b79
commit 2bf13cc56e

View file

@ -221,9 +221,15 @@ export default function CompanyBrainConnections() {
toast.error("Only admins can connect the shared org account.")
return
}
if (!res.ok) {
toast.error("Couldn't start the connection.")
return
}
const data = (await res.json()) as { url?: string; error?: string }
if (data.url) window.open(data.url, "_blank", "noopener")
else toast.error(data.error ?? "Couldn't start the connection.")
} catch {
toast.error("Couldn't start the connection.")
} finally {
setBusy(null)
}