fix(l1): handle 402 seat_limit_exceeded on invite

Catches the structured detail from the seat-enforcement 402 and surfaces
a clear toast with current/limit counts instead of a silent failure.
Modal-with-upgrade-link is a v2 polish — Phase 1 just ships a toast.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-28 16:21:38 -04:00
parent f436def20e
commit b5d8e82f64

View File

@@ -237,8 +237,17 @@ export function AccountSettingsPage() {
const invitesData = await accountsApi.getInvites()
setInvites(invitesData)
} catch (err) {
toast.error('Failed to send invitation')
console.error(err)
const resp = (err as any)?.response
if (resp?.status === 402 && resp?.data?.detail?.code === 'seat_limit_exceeded') {
const d = resp.data.detail
const label = d.role === 'l1_tech' ? 'L1' : 'Engineer'
toast.warning(
`${label} seats full: ${d.current}/${d.limit}. Upgrade your plan to add more.`,
)
} else {
toast.error('Failed to send invitation')
console.error(err)
}
} finally {
setIsInviting(false)
}