refactor(web): consolidate error-copy table to JSON source of truth
Three admin pages had divergent inline error-code → user-copy switch tables (with wording drift, including a stale "Settings → Integrations" that should have been Admin). Consolidate into web/src/lib/styles/error-copy.json, expose via web/src/lib/api/error-copy.ts (ERROR_COPY + copyForCode), and refactor the three pages to import the helper. Fixes the three-way drift; the only user-visible behavior change is the quarantine page now correctly says "Admin → Integrations". Sets up the JSON for the M7 Flutter client (#356) to consume the same table. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
import errorCopyJson from '../styles/error-copy.json';
|
||||
|
||||
export const ERROR_COPY: Readonly<Record<string, string>> = errorCopyJson;
|
||||
|
||||
export function copyForCode(code: string | null | undefined): string {
|
||||
if (!code) return ERROR_COPY.unknown ?? 'Something went wrong.';
|
||||
return ERROR_COPY[code] ?? ERROR_COPY.unknown ?? 'Something went wrong.';
|
||||
}
|
||||
Reference in New Issue
Block a user