@addsign/moje-agenda-shared-lib 0.0.32 → 0.0.33
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.
- package/dist/main.d.ts +1 -0
- package/dist/main.js +2 -0
- package/dist/main.js.map +1 -1
- package/dist/types.d.ts +7 -0
- package/dist/utils/handleErrors.d.ts +6 -0
- package/dist/utils/handleErrors.js +17 -0
- package/dist/utils/handleErrors.js.map +1 -0
- package/package.json +1 -1
package/dist/main.d.ts
CHANGED
|
@@ -14,4 +14,5 @@ export * from './contexts/FederationContext.tsx';
|
|
|
14
14
|
export * from './contexts/useFederationContext.ts';
|
|
15
15
|
export * from './utils/getFullName.ts';
|
|
16
16
|
export * from './utils/getIntersectingDays.ts';
|
|
17
|
+
export * from './utils/handleErrors.ts';
|
|
17
18
|
export * from './types.ts';
|
package/dist/main.js
CHANGED
|
@@ -13,6 +13,7 @@ import { FederationContext, FederationContextProvider } from "./contexts/Federat
|
|
|
13
13
|
import { useFederationContext } from "./contexts/useFederationContext.js";
|
|
14
14
|
import { getFullName, getFullNameList } from "./utils/getFullName.js";
|
|
15
15
|
import { getIntersectingDays } from "./utils/getIntersectingDays.js";
|
|
16
|
+
import { handleErrors } from "./utils/handleErrors.js";
|
|
16
17
|
export {
|
|
17
18
|
default3 as AutocompleteSearchBar,
|
|
18
19
|
default2 as Button,
|
|
@@ -29,6 +30,7 @@ export {
|
|
|
29
30
|
getFullName,
|
|
30
31
|
getFullNameList,
|
|
31
32
|
getIntersectingDays,
|
|
33
|
+
handleErrors,
|
|
32
34
|
useFederationContext
|
|
33
35
|
};
|
|
34
36
|
//# sourceMappingURL=main.js.map
|
package/dist/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"main.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;"}
|
package/dist/types.d.ts
CHANGED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const handleErrors = (error, emitter, customMessage) => {
|
|
2
|
+
var errmsgToDisplay;
|
|
3
|
+
if (error.code == "ERR_BAD_REQUEST") {
|
|
4
|
+
errmsgToDisplay = "Interní chyba aplikace: " + error.message;
|
|
5
|
+
} else {
|
|
6
|
+
errmsgToDisplay = customMessage || error.message;
|
|
7
|
+
}
|
|
8
|
+
console.error(error);
|
|
9
|
+
emitter.emit("message", {
|
|
10
|
+
message: "Interní chyba aplikace " + errmsgToDisplay,
|
|
11
|
+
classes: "bg-error "
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
export {
|
|
15
|
+
handleErrors
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=handleErrors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handleErrors.js","sources":["../../lib/utils/handleErrors.ts"],"sourcesContent":["import { AxiosError } from \"axios\";\r\nimport { Emitter } from \"mitt\";\r\nimport { Events } from \"../types\";\r\n\r\nconst handleErrors = (error: AxiosError, emitter: Emitter<Events>, customMessage?: string) => {\r\n var errmsgToDisplay;\r\n if (error.code == 'ERR_BAD_REQUEST') {\r\n errmsgToDisplay = \"Interní chyba aplikace: \" + error.message;\r\n } else {\r\n errmsgToDisplay = customMessage || error.message;\r\n }\r\n console.error(error);\r\n emitter.emit(\"message\", {\r\n message: \"Interní chyba aplikace \" + errmsgToDisplay,\r\n classes: \"bg-error \",\r\n });\r\n}\r\nexport { handleErrors }"],"names":[],"mappings":"AAIA,MAAM,eAAe,CAAC,OAAmB,SAA0B,kBAA2B;AACtF,MAAA;AACA,MAAA,MAAM,QAAQ,mBAAmB;AACjC,sBAAkB,6BAA6B,MAAM;AAAA,EAAA,OAClD;AACH,sBAAkB,iBAAiB,MAAM;AAAA,EAC7C;AACA,UAAQ,MAAM,KAAK;AACnB,UAAQ,KAAK,WAAW;AAAA,IACpB,SAAS,4BAA4B;AAAA,IACrC,SAAS;AAAA,EAAA,CACZ;AACL;"}
|