feat(admin-web): show centered modal in Chinese when AI points are insufficient
- Add `ai_points_insufficient` / `ai_points_unavailable` Chinese mappings in errors.ts so the toast copy is localized. - Add `showAiPointsInsufficientModal()` helper that renders a centered `Modal.confirm` with localized title/body and a "查看点数明细" action that routes to `/account/ai-points`. The helper is debounced so concurrent failed requests do not stack multiple modals. - Trigger the modal globally from the admin-web response interceptor when the backend returns `ai_points_insufficient`, so every AI-generating endpoint surfaces the same prominent prompt without per-callsite changes. - Drop the English `detail` for ai_points_insufficient in `formatError` so the secondary toast stays pure Chinese. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -315,6 +315,12 @@ apiClient.raw.interceptors.response.use(
|
||||
markStoredMembershipBlocked(error.message)
|
||||
}
|
||||
|
||||
if (error instanceof ApiClientError && error.message === 'ai_points_insufficient') {
|
||||
void import('./errors').then(({ showAiPointsInsufficientModal }) => {
|
||||
showAiPointsInsufficientModal()
|
||||
})
|
||||
}
|
||||
|
||||
return Promise.reject(error)
|
||||
},
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user