@duxweb/dvha-core 0.1.6 → 0.1.8

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/esm/index.js CHANGED
@@ -1,48 +1,50 @@
1
1
  import { createDux as o } from "./main.js";
2
- import { useCan as u, useCheck as s, useError as a, useForgotPassword as p, useGetAuth as x, useIsLogin as m, useLogin as f, useLogout as n, useRegister as i, useUpdatePassword as d } from "./hooks/auth.js";
3
- import { useConfig as g } from "./hooks/config.js";
4
- import { useClient as C, useCreate as M, useCreateMany as v, useCustom as y, useCustomMutation as L, useDelete as T, useDeleteMany as h, useInfiniteList as I, useInvalidate as P, useList as A, useMany as S, useOne as R, useUpdate as c, useUpdateMany as w } from "./hooks/data.js";
2
+ import { useCan as u, useCheck as s, useError as a, useForgotPassword as m, useGetAuth as p, useIsLogin as x, useLogin as f, useLogout as n, useRegister as i, useUpdatePassword as d } from "./hooks/auth.js";
3
+ import { useConfig as D } from "./hooks/config.js";
4
+ import { useClient as C, useCreate as M, useCreateMany as v, useCustom as y, useCustomMutation as L, useDelete as T, useDeleteMany as h, useInfiniteList as I, useInvalidate as P, useList as S, useMany as A, useOne as c, useUpdate as R, useUpdateMany as w } from "./hooks/data.js";
5
5
  import { useManage as U } from "./hooks/manage.js";
6
- import { useMenu as k } from "./hooks/menu.js";
7
- import { useTheme as F } from "./hooks/theme.js";
6
+ import { useMenu as F } from "./hooks/menu.js";
7
+ import { useTheme as E } from "./hooks/theme.js";
8
8
  import { useOverlay as V } from "./hooks/overlay.js";
9
9
  import { useI18n as q } from "./hooks/i18n.js";
10
- import { initRouter as B } from "./router/route.js";
11
- import { useAuthStore as J } from "./stores/auth.js";
12
- import { useRouteStore as N } from "./stores/route.js";
13
- import { useTabStore as W } from "./stores/tab.js";
14
- import { useManageStore as Y } from "./stores/manage.js";
15
- import { useI18nStore as _ } from "./stores/i18n.js";
16
- import { DuxLogo as ee } from "./components/common/logo.js";
17
- import { default as oe } from "./components/loader/iframe.js";
18
- import { DuxOverlay as ue } from "./components/overlay/overlay.js";
19
- import { DuxCan as ae } from "./components/auth/can.js";
20
- import { arrayToTree as xe, searchTree as me, treeToArr as fe } from "./utils/tree.js";
21
- import { DuxAppProvider as ie } from "./provider/app.js";
22
- import { DuxTabRouterView as De } from "./provider/tab.js";
23
- import { simpleAuthProvider as le } from "./preset/authProvider.js";
24
- import { simpleDataProvider as Me } from "./preset/dataProvider.js";
25
- import { i18nProvider as ye } from "./preset/i18nProvider.js";
10
+ import { useSelect as B } from "./hooks/select.js";
11
+ import { useForm as J } from "./hooks/form.js";
12
+ import { initRouter as N } from "./router/route.js";
13
+ import { useAuthStore as W } from "./stores/auth.js";
14
+ import { useRouteStore as Y } from "./stores/route.js";
15
+ import { useTabStore as _ } from "./stores/tab.js";
16
+ import { useManageStore as ee } from "./stores/manage.js";
17
+ import { useI18nStore as oe } from "./stores/i18n.js";
18
+ import { DuxLogo as ue } from "./components/common/logo.js";
19
+ import { default as ae } from "./components/loader/iframe.js";
20
+ import { DuxOverlay as pe } from "./components/overlay/overlay.js";
21
+ import { DuxCan as fe } from "./components/auth/can.js";
22
+ import { arrayToTree as ie, searchTree as de, treeToArr as le } from "./utils/tree.js";
23
+ import { DuxAppProvider as ge } from "./provider/app.js";
24
+ import { DuxTabRouterView as Me } from "./provider/tab.js";
25
+ import { simpleAuthProvider as ye } from "./preset/authProvider.js";
26
+ import { simpleDataProvider as Te } from "./preset/dataProvider.js";
27
+ import { i18nProvider as Ie } from "./preset/i18nProvider.js";
26
28
  export {
27
- ie as DuxAppProvider,
28
- ae as DuxCan,
29
- oe as DuxLoaderIframe,
30
- ee as DuxLogo,
31
- ue as DuxOverlay,
32
- De as DuxTabRouterView,
33
- xe as arrayToTree,
29
+ ge as DuxAppProvider,
30
+ fe as DuxCan,
31
+ ae as DuxLoaderIframe,
32
+ ue as DuxLogo,
33
+ pe as DuxOverlay,
34
+ Me as DuxTabRouterView,
35
+ ie as arrayToTree,
34
36
  o as createDux,
35
- ye as i18nProvider,
36
- B as initRouter,
37
- me as searchTree,
38
- le as simpleAuthProvider,
39
- Me as simpleDataProvider,
40
- fe as treeToArr,
41
- J as useAuthStore,
37
+ Ie as i18nProvider,
38
+ N as initRouter,
39
+ de as searchTree,
40
+ ye as simpleAuthProvider,
41
+ Te as simpleDataProvider,
42
+ le as treeToArr,
43
+ W as useAuthStore,
42
44
  u as useCan,
43
45
  s as useCheck,
44
46
  C as useClient,
45
- g as useConfig,
47
+ D as useConfig,
46
48
  M as useCreate,
47
49
  v as useCreateMany,
48
50
  y as useCustom,
@@ -50,27 +52,29 @@ export {
50
52
  T as useDelete,
51
53
  h as useDeleteMany,
52
54
  a as useError,
53
- p as useForgotPassword,
54
- x as useGetAuth,
55
+ m as useForgotPassword,
56
+ J as useForm,
57
+ p as useGetAuth,
55
58
  q as useI18n,
56
- _ as useI18nStore,
59
+ oe as useI18nStore,
57
60
  I as useInfiniteList,
58
61
  P as useInvalidate,
59
- m as useIsLogin,
60
- A as useList,
62
+ x as useIsLogin,
63
+ S as useList,
61
64
  f as useLogin,
62
65
  n as useLogout,
63
66
  U as useManage,
64
- Y as useManageStore,
65
- S as useMany,
66
- k as useMenu,
67
- R as useOne,
67
+ ee as useManageStore,
68
+ A as useMany,
69
+ F as useMenu,
70
+ c as useOne,
68
71
  V as useOverlay,
69
72
  i as useRegister,
70
- N as useRouteStore,
71
- W as useTabStore,
72
- F as useTheme,
73
- c as useUpdate,
73
+ Y as useRouteStore,
74
+ B as useSelect,
75
+ _ as useTabStore,
76
+ E as useTheme,
77
+ R as useUpdate,
74
78
  w as useUpdateMany,
75
79
  d as useUpdatePassword
76
80
  };
@@ -1,46 +1,46 @@
1
1
  import g from "axios";
2
- function m(t) {
2
+ function m(e) {
3
3
  return {
4
4
  login: async (n, c) => {
5
5
  var d;
6
- return await g.post(c.getApiUrl(((d = t == null ? void 0 : t.apiPath) == null ? void 0 : d.login) || "/login", t == null ? void 0 : t.dataProviderName), n).then((e) => {
6
+ return await g.post(c.getApiUrl(((d = e == null ? void 0 : e.apiPath) == null ? void 0 : d.login) || "/login", e == null ? void 0 : e.dataProviderName), n).then((t) => {
7
7
  var i, a, s;
8
8
  return {
9
9
  success: !0,
10
- message: (i = e == null ? void 0 : e.data) == null ? void 0 : i.message,
11
- redirectTo: ((a = t == null ? void 0 : t.routePath) == null ? void 0 : a.index) || "/",
12
- data: (s = e == null ? void 0 : e.data) == null ? void 0 : s.data
10
+ message: (i = t == null ? void 0 : t.data) == null ? void 0 : i.message,
11
+ redirectTo: ((a = e == null ? void 0 : e.routePath) == null ? void 0 : a.index) || "/",
12
+ data: (s = t == null ? void 0 : t.data) == null ? void 0 : s.data
13
13
  };
14
- }).catch((e) => {
14
+ }).catch((t) => {
15
15
  var i, a;
16
16
  return {
17
17
  success: !1,
18
- message: ((a = (i = e == null ? void 0 : e.response) == null ? void 0 : i.data) == null ? void 0 : a.message) || (e == null ? void 0 : e.message)
18
+ message: ((a = (i = t == null ? void 0 : t.response) == null ? void 0 : i.data) == null ? void 0 : a.message) || (t == null ? void 0 : t.message)
19
19
  };
20
20
  });
21
21
  },
22
22
  check: async (n, c) => {
23
23
  var d;
24
- return await g.get((c == null ? void 0 : c.getApiUrl(((d = t == null ? void 0 : t.apiPath) == null ? void 0 : d.check) || "/check", t == null ? void 0 : t.dataProviderName)) || "").then((e) => {
24
+ return await g.get((c == null ? void 0 : c.getApiUrl(((d = e == null ? void 0 : e.apiPath) == null ? void 0 : d.check) || "/check", e == null ? void 0 : e.dataProviderName)) || "").then((t) => {
25
25
  var i, a;
26
26
  return {
27
27
  success: !0,
28
- message: (i = e == null ? void 0 : e.data) == null ? void 0 : i.message,
29
- data: (a = e == null ? void 0 : e.data) == null ? void 0 : a.data
28
+ message: (i = t == null ? void 0 : t.data) == null ? void 0 : i.message,
29
+ data: (a = t == null ? void 0 : t.data) == null ? void 0 : a.data
30
30
  };
31
- }).catch((e) => {
31
+ }).catch((t) => {
32
32
  var i, a;
33
33
  return {
34
34
  success: !1,
35
- message: ((a = (i = e == null ? void 0 : e.response) == null ? void 0 : i.data) == null ? void 0 : a.message) || (e == null ? void 0 : e.message)
35
+ message: ((a = (i = t == null ? void 0 : t.response) == null ? void 0 : i.data) == null ? void 0 : a.message) || (t == null ? void 0 : t.message)
36
36
  };
37
37
  });
38
38
  },
39
39
  onError: async (n) => {
40
40
  var c;
41
- return n.status === 403 ? {
41
+ return (n == null ? void 0 : n.status) === 401 ? {
42
42
  logout: !0,
43
- redirectTo: ((c = t == null ? void 0 : t.routePath) == null ? void 0 : c.login) || "/login",
43
+ redirectTo: ((c = e == null ? void 0 : e.routePath) == null ? void 0 : c.login) || "/login",
44
44
  error: n
45
45
  } : {
46
46
  logout: !1,
@@ -51,64 +51,64 @@ function m(t) {
51
51
  var n;
52
52
  return {
53
53
  success: !0,
54
- redirectTo: ((n = t == null ? void 0 : t.routePath) == null ? void 0 : n.login) || "/login"
54
+ redirectTo: ((n = e == null ? void 0 : e.routePath) == null ? void 0 : n.login) || "/login"
55
55
  };
56
56
  },
57
57
  register: async (n, c) => {
58
58
  var d;
59
- return await g.post((c == null ? void 0 : c.getApiUrl(((d = t == null ? void 0 : t.apiPath) == null ? void 0 : d.register) || "/register", t == null ? void 0 : t.dataProviderName)) || "", n).then((e) => {
59
+ return await g.post((c == null ? void 0 : c.getApiUrl(((d = e == null ? void 0 : e.apiPath) == null ? void 0 : d.register) || "/register", e == null ? void 0 : e.dataProviderName)) || "", n).then((t) => {
60
60
  var i, a, s;
61
61
  return {
62
62
  success: !0,
63
- message: (i = e == null ? void 0 : e.data) == null ? void 0 : i.message,
64
- redirectTo: ((a = t == null ? void 0 : t.routePath) == null ? void 0 : a.index) || "/",
65
- data: (s = e == null ? void 0 : e.data) == null ? void 0 : s.data
63
+ message: (i = t == null ? void 0 : t.data) == null ? void 0 : i.message,
64
+ redirectTo: ((a = e == null ? void 0 : e.routePath) == null ? void 0 : a.index) || "/",
65
+ data: (s = t == null ? void 0 : t.data) == null ? void 0 : s.data
66
66
  };
67
- }).catch((e) => {
67
+ }).catch((t) => {
68
68
  var i, a;
69
69
  return {
70
70
  success: !1,
71
- message: ((a = (i = e == null ? void 0 : e.response) == null ? void 0 : i.data) == null ? void 0 : a.message) || (e == null ? void 0 : e.message)
71
+ message: ((a = (i = t == null ? void 0 : t.response) == null ? void 0 : i.data) == null ? void 0 : a.message) || (t == null ? void 0 : t.message)
72
72
  };
73
73
  });
74
74
  },
75
75
  forgotPassword: async (n, c) => {
76
76
  var d;
77
- return await g.post((c == null ? void 0 : c.getApiUrl(((d = t == null ? void 0 : t.apiPath) == null ? void 0 : d.forgotPassword) || "/forgot-password", t == null ? void 0 : t.dataProviderName)) || "", n).then((e) => {
77
+ return await g.post((c == null ? void 0 : c.getApiUrl(((d = e == null ? void 0 : e.apiPath) == null ? void 0 : d.forgotPassword) || "/forgot-password", e == null ? void 0 : e.dataProviderName)) || "", n).then((t) => {
78
78
  var i, a;
79
79
  return {
80
80
  success: !0,
81
- message: (i = e == null ? void 0 : e.data) == null ? void 0 : i.message,
82
- redirectTo: ((a = t == null ? void 0 : t.routePath) == null ? void 0 : a.login) || "/login"
81
+ message: (i = t == null ? void 0 : t.data) == null ? void 0 : i.message,
82
+ redirectTo: ((a = e == null ? void 0 : e.routePath) == null ? void 0 : a.login) || "/login"
83
83
  };
84
- }).catch((e) => {
84
+ }).catch((t) => {
85
85
  var i, a;
86
86
  return {
87
87
  success: !1,
88
- message: ((a = (i = e == null ? void 0 : e.response) == null ? void 0 : i.data) == null ? void 0 : a.message) || (e == null ? void 0 : e.message)
88
+ message: ((a = (i = t == null ? void 0 : t.response) == null ? void 0 : i.data) == null ? void 0 : a.message) || (t == null ? void 0 : t.message)
89
89
  };
90
90
  });
91
91
  },
92
92
  updatePassword: async (n, c) => {
93
93
  var d;
94
- return await g.post((c == null ? void 0 : c.getApiUrl(((d = t == null ? void 0 : t.apiPath) == null ? void 0 : d.updatePassword) || "/update-password", t == null ? void 0 : t.dataProviderName)) || "", n).then((e) => {
94
+ return await g.post((c == null ? void 0 : c.getApiUrl(((d = e == null ? void 0 : e.apiPath) == null ? void 0 : d.updatePassword) || "/update-password", e == null ? void 0 : e.dataProviderName)) || "", n).then((t) => {
95
95
  var i, a;
96
96
  return {
97
97
  success: !0,
98
- message: (i = e == null ? void 0 : e.data) == null ? void 0 : i.message,
99
- redirectTo: ((a = t == null ? void 0 : t.routePath) == null ? void 0 : a.login) || "/login"
98
+ message: (i = t == null ? void 0 : t.data) == null ? void 0 : i.message,
99
+ redirectTo: ((a = e == null ? void 0 : e.routePath) == null ? void 0 : a.login) || "/login"
100
100
  };
101
- }).catch((e) => {
101
+ }).catch((t) => {
102
102
  var i, a;
103
103
  return {
104
104
  success: !1,
105
- message: ((a = (i = e == null ? void 0 : e.response) == null ? void 0 : i.data) == null ? void 0 : a.message) || (e == null ? void 0 : e.message)
105
+ message: ((a = (i = t == null ? void 0 : t.response) == null ? void 0 : i.data) == null ? void 0 : a.message) || (t == null ? void 0 : t.message)
106
106
  };
107
107
  });
108
108
  },
109
- can: (n, c, d, e) => {
109
+ can: (n, c, d, t) => {
110
110
  var i, a;
111
- return !(e != null && e.permission) || Array.isArray(e == null ? void 0 : e.permission) && ((i = e == null ? void 0 : e.permission) == null ? void 0 : i.length) === 0 || typeof (e == null ? void 0 : e.permission) == "object" && Object.keys(e == null ? void 0 : e.permission).length === 0 ? !0 : !(Array.isArray(e == null ? void 0 : e.permission) && !((a = e == null ? void 0 : e.permission) != null && a.includes(n)) || typeof (e == null ? void 0 : e.permission) == "object" && (e == null ? void 0 : e.permission[n]) === !1);
111
+ return !(t != null && t.permission) || Array.isArray(t == null ? void 0 : t.permission) && ((i = t == null ? void 0 : t.permission) == null ? void 0 : i.length) === 0 || typeof (t == null ? void 0 : t.permission) == "object" && Object.keys(t == null ? void 0 : t.permission).length === 0 ? !0 : !(Array.isArray(t == null ? void 0 : t.permission) && !((a = t == null ? void 0 : t.permission) != null && a.includes(n)) || typeof (t == null ? void 0 : t.permission) == "object" && (t == null ? void 0 : t.permission[n]) === !1);
112
112
  }
113
113
  };
114
114
  }
@@ -1,104 +1,143 @@
1
- import d from "axios";
2
- import { trimStart as i } from "lodash-es";
3
- function z(g) {
4
- const t = (e) => e ? `${g.apiUrl}/${i(e || "", "/")}` : g.apiUrl;
1
+ import n from "axios";
2
+ import { trimStart as m } from "lodash-es";
3
+ function g(c) {
4
+ const r = (a) => a ? `${c.apiUrl}/${m(a || "", "/")}` : c.apiUrl;
5
5
  return {
6
- apiUrl: t,
7
- getList: (e, n, r) => {
8
- const a = {};
9
- return e.pagination && typeof e.pagination == "object" && (a.page = e.pagination.page, a.pageSize = e.pagination.pageSize), d.get(t(e.path) || "", {
6
+ apiUrl: r,
7
+ getList: (a, l, t) => {
8
+ const e = {};
9
+ return a.pagination && typeof a.pagination == "object" && (e.page = a.pagination.page, e.pageSize = a.pagination.pageSize), n.get(r(a.path) || "", {
10
10
  params: {
11
- ...a,
12
- ...e.filters,
13
- ...e.sorters
11
+ ...e,
12
+ ...a.filters,
13
+ ...a.sorters
14
14
  },
15
15
  headers: {
16
- Authorization: r == null ? void 0 : r.token
16
+ Authorization: t == null ? void 0 : t.token
17
17
  },
18
- ...e.meta
19
- }).then((m) => m.data);
18
+ ...a.meta
19
+ }).then((d) => c.successCallback ? c.successCallback(d) : k(d)).catch((d) => {
20
+ throw c.errorCallback ? c.errorCallback(d) : b(d);
21
+ });
20
22
  },
21
- create: (e, n, r) => d.post(t(e.path) || "", e.data, {
23
+ create: (a, l, t) => n.post(r(a.path) || "", a.data, {
22
24
  headers: {
23
- Authorization: r == null ? void 0 : r.token
25
+ Authorization: t == null ? void 0 : t.token
24
26
  },
25
- ...e.meta
26
- }).then((a) => a.data),
27
- update: (e, n, r) => d.put(t(e.id ? `${e.path}/${e.id}` : e.path) || "", e.data, {
27
+ ...a.meta
28
+ }).then((e) => c.successCallback ? c.successCallback(e) : k(e)).catch((e) => {
29
+ throw c.errorCallback ? c.errorCallback(e) : b(e);
30
+ }),
31
+ update: (a, l, t) => n.put(r(a.id ? `${a.path}/${a.id}` : a.path) || "", a.data, {
28
32
  headers: {
29
- Authorization: r == null ? void 0 : r.token
33
+ Authorization: t == null ? void 0 : t.token
30
34
  },
31
- ...e.meta
32
- }).then((a) => a.data),
33
- deleteOne: (e, n, r) => d.delete(t(e.id ? `${e.path}/${e.id}` : e.path) || "", {
35
+ ...a.meta
36
+ }).then((e) => c.successCallback ? c.successCallback(e) : k(e)).catch((e) => {
37
+ throw c.errorCallback ? c.errorCallback(e) : b(e);
38
+ }),
39
+ deleteOne: (a, l, t) => n.delete(r(a.id ? `${a.path}/${a.id}` : a.path) || "", {
34
40
  headers: {
35
- Authorization: r == null ? void 0 : r.token
41
+ Authorization: t == null ? void 0 : t.token
36
42
  },
37
- ...e.meta
38
- }).then((a) => a.data),
39
- getOne: (e, n, r) => d.get(t(e.id ? `${e.path}/${e.id}` : e.path) || "", {
43
+ ...a.meta
44
+ }).then((e) => c.successCallback ? c.successCallback(e) : k(e)).catch((e) => {
45
+ throw c.errorCallback ? c.errorCallback(e) : b(e);
46
+ }),
47
+ getOne: (a, l, t) => n.get(r(a.id ? `${a.path}/${a.id}` : a.path) || "", {
40
48
  headers: {
41
- Authorization: r == null ? void 0 : r.token
49
+ Authorization: t == null ? void 0 : t.token
42
50
  },
43
- ...e.meta
44
- }).then((a) => a.data),
45
- getMany: (e, n, r) => d.get(t(e.path) || "", {
51
+ ...a.meta
52
+ }).then((e) => c.successCallback ? c.successCallback(e) : k(e)).catch((e) => {
53
+ throw c.errorCallback ? c.errorCallback(e) : b(e);
54
+ }),
55
+ getMany: (a, l, t) => n.get(r(a.path) || "", {
46
56
  params: {
47
- ids: e.ids
57
+ ids: a.ids
48
58
  },
49
59
  headers: {
50
- Authorization: r == null ? void 0 : r.token
60
+ Authorization: t == null ? void 0 : t.token
51
61
  },
52
- ...e.meta
53
- }).then((a) => a.data),
54
- createMany: (e, n, r) => d.post(t(e.path) || "", e.data, {
62
+ ...a.meta
63
+ }).then((e) => c.successCallback ? c.successCallback(e) : k(e)).catch((e) => {
64
+ throw c.errorCallback ? c.errorCallback(e) : b(e);
65
+ }),
66
+ createMany: (a, l, t) => n.post(r(a.path) || "", a.data, {
55
67
  headers: {
56
- Authorization: r == null ? void 0 : r.token
68
+ Authorization: t == null ? void 0 : t.token
57
69
  },
58
- ...e.meta
59
- }).then((a) => a.data),
60
- updateMany: (e, n, r) => d.put(t(e.path) || "", {
61
- ids: e.ids,
62
- data: e.data
70
+ ...a.meta
71
+ }).then((e) => c.successCallback ? c.successCallback(e) : k(e)).catch((e) => {
72
+ throw c.errorCallback ? c.errorCallback(e) : b(e);
73
+ }),
74
+ updateMany: (a, l, t) => n.put(r(a.path) || "", {
75
+ ids: a.ids,
76
+ data: a.data
63
77
  }, {
64
78
  headers: {
65
- Authorization: r == null ? void 0 : r.token
79
+ Authorization: t == null ? void 0 : t.token
66
80
  },
67
- ...e.meta
68
- }).then((a) => a.data),
69
- deleteMany: (e, n, r) => d.delete(t(e.path) || "", {
81
+ ...a.meta
82
+ }).then((e) => c.successCallback ? c.successCallback(e) : k(e)).catch((e) => {
83
+ throw c.errorCallback ? c.errorCallback(e) : b(e);
84
+ }),
85
+ deleteMany: (a, l, t) => n.delete(r(a.path) || "", {
70
86
  params: {
71
- ids: e.ids
87
+ ids: a.ids
72
88
  },
73
89
  headers: {
74
- Authorization: r == null ? void 0 : r.token
90
+ Authorization: t == null ? void 0 : t.token
75
91
  },
76
- ...e.meta
77
- }).then((a) => a.data),
78
- custom: (e, n, r) => {
79
- let a = {
80
- ...e.query
92
+ ...a.meta
93
+ }).then((e) => c.successCallback ? c.successCallback(e) : k(e)).catch((e) => {
94
+ throw c.errorCallback ? c.errorCallback(e) : b(e);
95
+ }),
96
+ custom: (a, l, t) => {
97
+ let e = {
98
+ ...a.query
81
99
  };
82
- return e.sorters && typeof e.sorters == "object" && (a = {
83
- ...a,
84
- ...e.sorters
85
- }), e.filters && typeof e.filters == "object" && (a = {
86
- ...a,
87
- ...e.filters
88
- }), d.request({
89
- url: t(e.path || ""),
90
- method: e.method || "GET",
91
- data: e.payload,
92
- params: a,
100
+ return a.sorters && typeof a.sorters == "object" && (e = {
101
+ ...e,
102
+ ...a.sorters
103
+ }), a.filters && typeof a.filters == "object" && (e = {
104
+ ...e,
105
+ ...a.filters
106
+ }), n.request({
107
+ url: r(a.path || ""),
108
+ method: a.method || "GET",
109
+ data: a.payload,
110
+ params: e,
93
111
  headers: {
94
- Authorization: r == null ? void 0 : r.token,
95
- ...e.headers
112
+ Authorization: t == null ? void 0 : t.token,
113
+ ...a.headers
96
114
  },
97
- ...e.meta
98
- }).then((m) => m.data);
115
+ ...a.meta
116
+ }).then((d) => c.successCallback ? c.successCallback(d) : k(d)).catch((d) => {
117
+ throw c.errorCallback ? c.errorCallback(d) : b(d);
118
+ });
99
119
  }
100
120
  };
101
121
  }
122
+ function k(c) {
123
+ var r, a, l;
124
+ return {
125
+ message: (r = c.data) == null ? void 0 : r.message,
126
+ data: (a = c.data) == null ? void 0 : a.data,
127
+ meta: (l = c.data) == null ? void 0 : l.meta,
128
+ raw: c.data
129
+ };
130
+ }
131
+ function b(c) {
132
+ var r, a, l, t;
133
+ return {
134
+ message: ((r = c.response.data) == null ? void 0 : r.message) || c.message,
135
+ data: (a = c.response.data) == null ? void 0 : a.data,
136
+ meta: (l = c.response.data) == null ? void 0 : l.meta,
137
+ status: ((t = c.response.data) == null ? void 0 : t.code) || c.response.status || 500,
138
+ raw: c.response.data
139
+ };
140
+ }
102
141
  export {
103
- z as simpleDataProvider
142
+ g as simpleDataProvider
104
143
  };
@@ -1,4 +1,4 @@
1
- import type { IAuthActionResponse, IAuthCheckResponse, IAuthErrorResponse, IAuthLoginResponse, IAuthLogoutResponse } from '../types';
1
+ import type { IAuthActionResponse, IAuthCheckResponse, IAuthErrorResponse, IAuthLoginResponse, IAuthLogoutResponse, IDataProviderError } from '../types';
2
2
  /**
3
3
  * Auth login params
4
4
  */
@@ -93,7 +93,7 @@ export declare function useUpdatePassword({ onSuccess, onError }: IAuthActionPar
93
93
  * @returns Error method
94
94
  */
95
95
  export declare function useError(onCallback?: (data?: IAuthErrorResponse) => void): {
96
- mutate: (error: any) => Promise<void>;
96
+ mutate: (error: IDataProviderError) => Promise<void>;
97
97
  };
98
98
  /**
99
99
  * Get auth