meeting page frontend fixes

This commit is contained in:
Igor Loskutov
2025-09-17 12:18:25 -04:00
parent 3bd2190aa8
commit 1764c591c4
16 changed files with 259 additions and 67 deletions

26
www/app/api/_error.ts Normal file
View File

@@ -0,0 +1,26 @@
import { components } from "../reflector-api";
import { isArray } from "remeda";
export type ApiError = {
detail?: components["schemas"]["ValidationError"][];
} | null;
// errors as declared on api types is not != as they in reality e.g. detail may be a string
export const printApiError = (error: ApiError) => {
if (!error || !error.detail) {
return null;
}
const detail = error.detail as unknown;
if (isArray(error.detail)) {
return error.detail.map((e) => e.msg).join(", ");
}
if (typeof detail === "string") {
if (detail.length > 0) {
return detail;
}
console.error("Error detail is empty");
return null;
}
console.error("Error detail is not a string or array");
return null;
};