UNPKG

@cgi-learning-hub/ui

Version:

@cgi-learning-hub/ui is an open-source React component library that implements UI for HUB's features

47 lines (46 loc) 1.37 kB
import { jsx as i } from "react/jsx-runtime"; import a from "../../client-error-D0Ng5oOn.js"; import r from "../../error-CRNeivL7.js"; import m from "../../server-error-CvgIy7ap.js"; import e from "../EmptyState/EmptyState.es.js"; import { isFetchBaseQueryError as n, isErrorWithMessage as o } from "./helpers.es.js"; const d = ({ error: t, statusPrefix: u = "Erreur " }) => { if (n(t)) { const s = "error" in t ? t.error : t.data ? JSON.stringify(t.data) : null; return typeof t.status == "number" && t.status.toString().startsWith("4") ? /* @__PURE__ */ i( e, { image: /* @__PURE__ */ i(a, { height: "100%" }), title: `Erreur client (${t.status})`, description: s ?? void 0 } ) : typeof t.status == "number" && t.status.toString().startsWith("5") ? /* @__PURE__ */ i( e, { image: /* @__PURE__ */ i(m, { height: "100%" }), title: `Erreur serveur (${t.status})`, description: s ?? void 0 } ) : /* @__PURE__ */ i( e, { image: /* @__PURE__ */ i(r, { height: "100%" }), title: `${u}${t.status}`, description: s ?? void 0 } ); } return /* @__PURE__ */ i( e, { image: /* @__PURE__ */ i(r, { height: "100%" }), title: o(t) ? t.message : "Une erreur est survenue" } ); }; export { d as default };