@addsign/moje-agenda-shared-lib 0.0.43 → 0.0.46
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/types.d.ts
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
const handleErrors = (error, emitter, customMessage) => {
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
var _a, _b, _c, _d;
|
|
3
|
+
var 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
|
+
var errorTitle = "";
|
|
5
|
+
if (error.code == "ERR_NETWORK") {
|
|
6
|
+
errorTitle = "Síťová chyba";
|
|
7
|
+
errmsgToDisplay = errmsgToDisplay + " " + (/* @__PURE__ */ new Date()).toLocaleString();
|
|
8
|
+
} else if (error.code == "ERR_BAD_REQUEST") {
|
|
9
|
+
errorTitle = "Interní chyba aplikace";
|
|
10
|
+
errmsgToDisplay = (/* @__PURE__ */ new Date()).toLocaleString() + " (" + ((_d = error.response) == null ? void 0 : _d.status) + ") \n" + errmsgToDisplay;
|
|
5
11
|
}
|
|
6
12
|
console.error(error);
|
|
7
13
|
emitter.emit("message", {
|
|
14
|
+
title: errorTitle,
|
|
8
15
|
message: errmsgToDisplay,
|
|
9
16
|
classes: "bg-danger ",
|
|
10
17
|
timeout: 0
|
|
@@ -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 var errmsgToDisplay = customMessage || error?.message\r\n if (error.code == '
|
|
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 = (customMessage || \"\") + \" \" + ((error.response?.data as any)?.error?.message || error.message || \"\")\r\n\r\n var 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\r\n errorTitle = \"Interní chyba aplikace\"\r\n errmsgToDisplay = new Date().toLocaleString() + \" (\" + error.response?.status + \") \\n\" + errmsgToDisplay;\r\n }\r\n console.error(error);\r\n emitter.emit(\"message\", {\r\n title: errorTitle,\r\n message: errmsgToDisplay,\r\n classes: \"bg-danger \",\r\n timeout: 0\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;AAEvH,MAAI,aAAa;AACb,MAAA,MAAM,QAAQ,eAAe;AAChB,iBAAA;AACb,sBAAkB,kBAAkB,OAAU,oBAAA,KAAA,GAAO;EAAe,WAC7D,MAAM,QAAQ,mBAAmB;AAE3B,iBAAA;AACK,uBAAA,oBAAI,KAAO,GAAA,mBAAmB,SAAO,WAAM,aAAN,mBAAgB,UAAS,SAAS;AAAA,EAC7F;AACA,UAAQ,MAAM,KAAK;AACnB,UAAQ,KAAK,WAAW;AAAA,IACpB,OAAO;AAAA,IACP,SAAS;AAAA,IACT,SAAS;AAAA,IACT,SAAS;AAAA,EAAA,CACZ;AACL;"}
|