feat: standardize shared UI primitives across frontend
This commit is contained in:
@@ -11,8 +11,8 @@ export const apiClient = axios.create({
|
||||
},
|
||||
})
|
||||
|
||||
// Global error handler - shows toast for common API errors
|
||||
// Pages can still catch errors explicitly if they need custom handling
|
||||
// Global error handler for shared cases only.
|
||||
// By convention, 4xx errors are handled at the page/component level.
|
||||
function handleGlobalError(error: AxiosError) {
|
||||
// Network error (no response from server)
|
||||
if (!error.response) {
|
||||
@@ -43,9 +43,8 @@ function handleGlobalError(error: AxiosError) {
|
||||
return
|
||||
}
|
||||
|
||||
// Client errors (4xx) — don't toast globally.
|
||||
// Pages handle their own 4xx errors (permission checks, validation, not-found)
|
||||
// and many are caught silently. Global toasts here cause noisy duplicates.
|
||||
// Client errors (4xx) remain page-owned to avoid duplicate/noisy toasts.
|
||||
// Global handling only covers 401/429/5xx.
|
||||
if (status >= 400 && status < 500) {
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user