refactor(frontend): add ApiError interface and extractErrorCode helper
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -23,3 +23,12 @@ export function createApiClient(fetch: typeof globalThis.fetch) {
|
|||||||
fetch
|
fetch
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface ApiError {
|
||||||
|
code?: string;
|
||||||
|
message?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function extractErrorCode(error: unknown): string | undefined {
|
||||||
|
return (error as ApiError | undefined)?.code;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user