tycho-components 0.14.23 → 0.15.0

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.
@@ -6,7 +6,7 @@ type MessageDispatcher = {
6
6
  };
7
7
  type ErrorDispatcher = {
8
8
  err: any;
9
- t: TFunction;
9
+ t?: TFunction;
10
10
  key?: string;
11
11
  };
12
12
  export declare const useMessageUtils: () => {
@@ -13,9 +13,15 @@ export const useMessageUtils = () => {
13
13
  return state.toastLoading;
14
14
  };
15
15
  const dispatchLoading = (val, text) => {
16
- dispatch(text !== undefined ? toastLoading({ loading: val, text }) : toastLoading(val));
16
+ dispatch(text !== undefined
17
+ ? toastLoading({ loading: val, text })
18
+ : toastLoading(val));
17
19
  };
18
20
  const dispatchError = ({ err, t, key }) => {
21
+ if (!t) {
22
+ dispatch(message({ value: err, type: "error" }));
23
+ return;
24
+ }
19
25
  if (!err.response) {
20
26
  const value = t(`${key ?? "message"}:${err}`);
21
27
  dispatch(message({ value, type: "error" }));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "tycho-components",
3
3
  "private": false,
4
- "version": "0.14.23",
4
+ "version": "0.15.0",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "exports": {
@@ -49,7 +49,7 @@
49
49
  "react-hook-form": "^7.45.2",
50
50
  "react-i18next": "^13.0.2",
51
51
  "react-router-dom": "^6.14.2",
52
- "tycho-storybook": "0.5.20",
52
+ "tycho-storybook": "0.6.0",
53
53
  "yup": "^1.2.0"
54
54
  },
55
55
  "devDependencies": {