refactor(frontend): extract extractErrorCode() helper to eliminate repeated type assertions #649

Merged
marcel merged 5 commits from feat/issue-113-extract-error-code into main 2026-05-21 09:31:54 +02:00
Showing only changes of commit fc9a02a6a0 - Show all commits

View File

@@ -23,3 +23,12 @@ export function createApiClient(fetch: typeof globalThis.fetch) {
fetch
});
}
export interface ApiError {
code?: string;
message?: string;
}
export function extractErrorCode(error: unknown): string | undefined {
return (error as ApiError | undefined)?.code;
}