feature: a minimal implementation of the appointment feature done.
This commit is contained in:
12
frontend/src/lib/formatApiError.ts
Normal file
12
frontend/src/lib/formatApiError.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
export function formatApiErrorMessage(err: unknown, fallback: string): string {
|
||||
if (err && typeof err === 'object' && 'message' in err) {
|
||||
const m = (err as { message: unknown }).message;
|
||||
if (Array.isArray(m)) {
|
||||
return m.filter(Boolean).join(', ');
|
||||
}
|
||||
if (typeof m === 'string' && m.trim()) {
|
||||
return m;
|
||||
}
|
||||
}
|
||||
return fallback;
|
||||
}
|
||||
Reference in New Issue
Block a user