@cgi-learning-hub/ui 0.0.1-dev.1718895916 → 0.0.1-dev.1718955714
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("react/jsx-runtime"),t=require("./helpers.cjs.js"),s=require("../../../Typography-6WB4M4zs.cjs"),
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),t=require("./helpers.cjs.js"),s=require("../../../Typography-6WB4M4zs.cjs"),u=({error:r,statusPrefix:n="Erreur "})=>{if(t.isFetchBaseQueryError(r)){const i="error"in r?r.error:r.data?JSON.stringify(r.data):null;return e.jsxs(s.Typography,{children:[e.jsx(s.Typography,{fontWeight:"bold",children:`${n}${r.status}`}),i]})}return t.isErrorWithMessage(r)?e.jsx(s.Typography,{children:r.message}):e.jsx(s.Typography,{children:"Une erreur est survenue."})};module.exports=u;
|
|
@@ -3,6 +3,7 @@ import { FetchBaseQueryError } from '@reduxjs/toolkit/query';
|
|
|
3
3
|
|
|
4
4
|
export interface QueryErrorProps {
|
|
5
5
|
error: FetchBaseQueryError | SerializedError | undefined;
|
|
6
|
+
statusPrefix?: string;
|
|
6
7
|
}
|
|
7
8
|
declare const QueryError: React.FunctionComponent<QueryErrorProps>;
|
|
8
9
|
export default QueryError;
|
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { isFetchBaseQueryError as
|
|
1
|
+
import { jsxs as n, jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { isFetchBaseQueryError as a, isErrorWithMessage as u } from "./helpers.es.js";
|
|
3
3
|
import { T as e } from "../../../Typography-D9Jbc-Y5.js";
|
|
4
|
-
const
|
|
5
|
-
error: r
|
|
4
|
+
const h = ({
|
|
5
|
+
error: r,
|
|
6
|
+
statusPrefix: t = "Erreur "
|
|
6
7
|
}) => {
|
|
7
|
-
if (
|
|
8
|
-
const
|
|
9
|
-
return /* @__PURE__ */
|
|
10
|
-
/* @__PURE__ */ s(e, { fontWeight: "bold", children:
|
|
11
|
-
|
|
8
|
+
if (a(r)) {
|
|
9
|
+
const i = "error" in r ? r.error : r.data ? JSON.stringify(r.data) : null;
|
|
10
|
+
return /* @__PURE__ */ n(e, { children: [
|
|
11
|
+
/* @__PURE__ */ s(e, { fontWeight: "bold", children: `${t}${r.status}` }),
|
|
12
|
+
i
|
|
12
13
|
] });
|
|
13
14
|
}
|
|
14
|
-
return
|
|
15
|
+
return u(r) ? /* @__PURE__ */ s(e, { children: r.message }) : /* @__PURE__ */ s(e, { children: "Une erreur est survenue." });
|
|
15
16
|
};
|
|
16
17
|
export {
|
|
17
|
-
|
|
18
|
+
h as default
|
|
18
19
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cgi-learning-hub/ui",
|
|
3
|
-
"version": "0.0.1-dev.
|
|
3
|
+
"version": "0.0.1-dev.1718955714",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "CGI Learning-hub Team",
|
|
6
6
|
"description": "@cgi-learning-hub/ui is an open-source React component library that implements UI for HUB's features",
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
"dist"
|
|
31
31
|
],
|
|
32
32
|
"devDependencies": {
|
|
33
|
+
"@reduxjs/toolkit": "^2.2.5",
|
|
33
34
|
"autoprefixer": "10.4.19",
|
|
34
35
|
"postcss": "8.4.38",
|
|
35
36
|
"tailwindcss": "3.4.3"
|
|
@@ -43,7 +44,6 @@
|
|
|
43
44
|
"@mui/x-date-pickers": "^6.19.4",
|
|
44
45
|
"@types/react": "^18.2.48",
|
|
45
46
|
"@types/react-dom": "^18.2.18",
|
|
46
|
-
"@reduxjs/toolkit": "^2.2.5",
|
|
47
47
|
"dayjs": "^1.11.10",
|
|
48
48
|
"react": "^18.2.0",
|
|
49
49
|
"react-dom": "^18.2.0",
|