@addsign/moje-agenda-shared-lib 2.0.29 → 2.0.30
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/assets/style.css
CHANGED
|
@@ -1799,6 +1799,9 @@ video {
|
|
|
1799
1799
|
--tw-bg-opacity: 1;
|
|
1800
1800
|
background-color: rgb(139 92 246 / var(--tw-bg-opacity));
|
|
1801
1801
|
}
|
|
1802
|
+
.bg-warning {
|
|
1803
|
+
background-color: var(--color-warning);
|
|
1804
|
+
}
|
|
1802
1805
|
.bg-white {
|
|
1803
1806
|
--tw-bg-opacity: 1;
|
|
1804
1807
|
background-color: rgb(255 255 255 / var(--tw-bg-opacity));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const handleErrors = (error, emitter, customMessage) => {
|
|
2
|
-
var _a, _b, _c, _d, _e;
|
|
2
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
3
3
|
let errmsgToDisplay = (customMessage || "") + " " + (((_c = (_b = (_a = error.response) == null ? void 0 : _a.data) == null ? void 0 : _b.error) == null ? void 0 : _c.message) || error.message || "");
|
|
4
4
|
let errorTitle = "";
|
|
5
5
|
if (error.code == "ERR_NETWORK") {
|
|
@@ -14,12 +14,14 @@ const handleErrors = (error, emitter, customMessage) => {
|
|
|
14
14
|
errmsgToDisplay = (/* @__PURE__ */ new Date()).toLocaleString() + " (" + ((_e = error.response) == null ? void 0 : _e.status) + ") \n" + errmsgToDisplay;
|
|
15
15
|
}
|
|
16
16
|
console.error(error);
|
|
17
|
+
const bgColor = ((_f = error.response) == null ? void 0 : _f.status) && ((_g = error.response) == null ? void 0 : _g.status) >= 400 ? " bg-danger " : " bg-warning ";
|
|
18
|
+
const type = ((_h = error.response) == null ? void 0 : _h.status) && ((_i = error.response) == null ? void 0 : _i.status) >= 400 ? "error" : "warning";
|
|
17
19
|
emitter.emit("message", {
|
|
18
20
|
title: errorTitle,
|
|
19
21
|
message: errmsgToDisplay,
|
|
20
|
-
classes: "bg-danger ",
|
|
22
|
+
classes: bgColor || " bg-danger ",
|
|
21
23
|
timeout: 0,
|
|
22
|
-
type
|
|
24
|
+
type
|
|
23
25
|
});
|
|
24
26
|
};
|
|
25
27
|
export {
|
|
@@ -1 +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 let errmsgToDisplay = (customMessage || \"\") + \" \" + ((error.response?.data as any)?.error?.message || error.message || \"\")\r\n
|
|
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 let errmsgToDisplay = (customMessage || \"\") + \" \" + ((error.response?.data as any)?.error?.message || error.message || \"\")\r\n let errorTitle = \"\"\r\n if (error.code == 'ERR_NETWORK') {\r\n errorTitle = \"Síťová chyba\"\r\n errmsgToDisplay = errmsgToDisplay + \" \" + new Date().toLocaleString();\r\n } else if (error.code == 'ERR_BAD_REQUEST') {\r\n if (error.response?.status == 403) {\r\n errorTitle = \"Přístup zamítnut\"\r\n } else {\r\n errorTitle = \"Interní chyba aplikace\"\r\n }\r\n errmsgToDisplay = new Date().toLocaleString() + \" (\" + error.response?.status + \") \\n\" + errmsgToDisplay;\r\n }\r\n console.error(error);\r\n const bgColor = error.response?.status && error.response?.status >= 400 ? \" bg-danger \" : \" bg-warning \";\r\n const type = error.response?.status && error.response?.status >= 400 ? \"error\" : \"warning\";\r\n emitter.emit(\"message\", {\r\n title: errorTitle,\r\n message: errmsgToDisplay,\r\n classes: bgColor || \" bg-danger \",\r\n timeout: 0,\r\n type: type\r\n });\r\n}\r\nexport { handleErrors }"],"names":[],"mappings":"AAIA,MAAM,eAAe,CAAC,OAAmB,SAA0B,kBAA2B;AAA9F;AACQ,MAAA,mBAAmB,iBAAiB,MAAM,SAAQ,uBAAM,aAAN,mBAAgB,SAAhB,mBAA8B,UAA9B,mBAAqC,YAAW,MAAM,WAAW;AACvH,MAAI,aAAa;AACb,MAAA,MAAM,QAAQ,eAAe;AAChB,iBAAA;AACb,sBAAkB,kBAAkB,OAAU,oBAAA,KAAA,GAAO;EAAe,WAC7D,MAAM,QAAQ,mBAAmB;AACpC,UAAA,WAAM,aAAN,mBAAgB,WAAU,KAAK;AAClB,mBAAA;AAAA,IAAA,OACV;AACU,mBAAA;AAAA,IACjB;AACkB,uBAAA,oBAAI,KAAO,GAAA,mBAAmB,SAAO,WAAM,aAAN,mBAAgB,UAAS,SAAS;AAAA,EAC7F;AACA,UAAQ,MAAM,KAAK;AACb,QAAA,YAAU,WAAM,aAAN,mBAAgB,aAAU,WAAM,aAAN,mBAAgB,WAAU,MAAM,gBAAgB;AACpF,QAAA,SAAO,WAAM,aAAN,mBAAgB,aAAU,WAAM,aAAN,mBAAgB,WAAU,MAAM,UAAU;AACjF,UAAQ,KAAK,WAAW;AAAA,IACpB,OAAO;AAAA,IACP,SAAS;AAAA,IACT,SAAS,WAAW;AAAA,IACpB,SAAS;AAAA,IACT;AAAA,EAAA,CACH;AACL;"}
|
|
@@ -4,7 +4,6 @@ import { Events } from "../types";
|
|
|
4
4
|
|
|
5
5
|
const handleErrors = (error: AxiosError, emitter: Emitter<Events>, customMessage?: string) => {
|
|
6
6
|
let errmsgToDisplay = (customMessage || "") + " " + ((error.response?.data as any)?.error?.message || error.message || "")
|
|
7
|
-
|
|
8
7
|
let errorTitle = ""
|
|
9
8
|
if (error.code == 'ERR_NETWORK') {
|
|
10
9
|
errorTitle = "Síťová chyba"
|
|
@@ -18,12 +17,14 @@ const handleErrors = (error: AxiosError, emitter: Emitter<Events>, customMessage
|
|
|
18
17
|
errmsgToDisplay = new Date().toLocaleString() + " (" + error.response?.status + ") \n" + errmsgToDisplay;
|
|
19
18
|
}
|
|
20
19
|
console.error(error);
|
|
20
|
+
const bgColor = error.response?.status && error.response?.status >= 400 ? " bg-danger " : " bg-warning ";
|
|
21
|
+
const type = error.response?.status && error.response?.status >= 400 ? "error" : "warning";
|
|
21
22
|
emitter.emit("message", {
|
|
22
23
|
title: errorTitle,
|
|
23
24
|
message: errmsgToDisplay,
|
|
24
|
-
classes: "bg-danger ",
|
|
25
|
+
classes: bgColor || " bg-danger ",
|
|
25
26
|
timeout: 0,
|
|
26
|
-
type:
|
|
27
|
+
type: type
|
|
27
28
|
});
|
|
28
29
|
}
|
|
29
30
|
export { handleErrors }
|