@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 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
@@ -89,3 +89,10 @@ export interface ITimeOffData {
89
89
  created?: string;
90
90
  updated?: string;
91
91
  }
92
+ export interface IDepartment {
93
+ departmentId: string;
94
+ nameLong: string;
95
+ parentDepartmentId: string;
96
+ parentLocationId: number;
97
+ nameShort: string;
98
+ }
@@ -0,0 +1,6 @@
1
+ import { AxiosError } from 'axios';
2
+ import { Emitter } from 'mitt';
3
+ import { Events } from '../types';
4
+
5
+ declare const handleErrors: (error: AxiosError, emitter: Emitter<Events>, customMessage?: string) => void;
6
+ export { handleErrors };
@@ -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;"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@addsign/moje-agenda-shared-lib",
3
3
  "private": false,
4
- "version": "0.0.32",
4
+ "version": "0.0.33",
5
5
  "type": "module",
6
6
  "main": "dist/main.js",
7
7
  "types": "dist/main.d.ts",