@refinedev/core 4.5.7 → 4.5.9
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/CHANGELOG.md +35 -0
- package/dist/esm/index.js +6 -6
- package/dist/esm/index.js.map +1 -1
- package/dist/hooks/auth/useForgotPassword/index.d.ts +7 -7
- package/dist/hooks/auth/useForgotPassword/index.d.ts.map +1 -1
- package/dist/hooks/auth/useLogin/index.d.ts +7 -7
- package/dist/hooks/auth/useLogin/index.d.ts.map +1 -1
- package/dist/hooks/auth/useLogout/index.d.ts +7 -7
- package/dist/hooks/auth/useLogout/index.d.ts.map +1 -1
- package/dist/hooks/auth/useRegister/index.d.ts +7 -7
- package/dist/hooks/auth/useRegister/index.d.ts.map +1 -1
- package/dist/hooks/auth/useUpdatePassword/index.d.ts +7 -7
- package/dist/hooks/auth/useUpdatePassword/index.d.ts.map +1 -1
- package/dist/hooks/data/useCreate.d.ts +4 -4
- package/dist/hooks/data/useCreate.d.ts.map +1 -1
- package/dist/hooks/data/useCreateMany.d.ts +4 -4
- package/dist/hooks/data/useCreateMany.d.ts.map +1 -1
- package/dist/hooks/data/useCustom.d.ts +2 -2
- package/dist/hooks/data/useCustom.d.ts.map +1 -1
- package/dist/hooks/data/useCustomMutation.d.ts +5 -5
- package/dist/hooks/data/useCustomMutation.d.ts.map +1 -1
- package/dist/hooks/data/useDelete.d.ts +4 -4
- package/dist/hooks/data/useDelete.d.ts.map +1 -1
- package/dist/hooks/data/useDeleteMany.d.ts +4 -4
- package/dist/hooks/data/useDeleteMany.d.ts.map +1 -1
- package/dist/hooks/data/useInfiniteList.d.ts +20 -17
- package/dist/hooks/data/useInfiniteList.d.ts.map +1 -1
- package/dist/hooks/data/useList.d.ts +13 -11
- package/dist/hooks/data/useList.d.ts.map +1 -1
- package/dist/hooks/data/useMany.d.ts +1 -1
- package/dist/hooks/data/useMany.d.ts.map +1 -1
- package/dist/hooks/data/useOne.d.ts +4 -2
- package/dist/hooks/data/useOne.d.ts.map +1 -1
- package/dist/hooks/data/useUpdate.d.ts +7 -4
- package/dist/hooks/data/useUpdate.d.ts.map +1 -1
- package/dist/hooks/data/useUpdateMany.d.ts +7 -4
- package/dist/hooks/data/useUpdateMany.d.ts.map +1 -1
- package/dist/hooks/form/useForm.d.ts +4 -1
- package/dist/hooks/form/useForm.d.ts.map +1 -1
- package/dist/hooks/show/useShow.d.ts +5 -3
- package/dist/hooks/show/useShow.d.ts.map +1 -1
- package/dist/hooks/useSelect/index.d.ts +2 -1
- package/dist/hooks/useSelect/index.d.ts.map +1 -1
- package/dist/hooks/useTable/index.d.ts +3 -2
- package/dist/hooks/useTable/index.d.ts.map +1 -1
- package/dist/iife/index.js +5 -5
- package/dist/iife/index.js.map +1 -1
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/dist/interfaces/bindings/auth.d.ts +4 -3
- package/dist/interfaces/bindings/auth.d.ts.map +1 -1
- package/dist/interfaces/errors/HttpError.d.ts.map +1 -0
- package/dist/interfaces/errors/RefineError.d.ts +3 -0
- package/dist/interfaces/errors/RefineError.d.ts.map +1 -0
- package/dist/interfaces/errors/index.d.ts +3 -0
- package/dist/interfaces/errors/index.d.ts.map +1 -0
- package/dist/interfaces/index.d.ts +1 -1
- package/dist/interfaces/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/hooks/auth/useForgotPassword/index.ts +22 -9
- package/src/hooks/auth/useLogin/index.ts +27 -11
- package/src/hooks/auth/useLogout/index.ts +16 -10
- package/src/hooks/auth/useRegister/index.ts +22 -9
- package/src/hooks/auth/useUpdatePassword/index.ts +31 -8
- package/src/hooks/data/useCreate.ts +6 -6
- package/src/hooks/data/useCreateMany.ts +6 -6
- package/src/hooks/data/useCustom.ts +6 -1
- package/src/hooks/data/useCustomMutation.ts +11 -6
- package/src/hooks/data/useDelete.ts +5 -5
- package/src/hooks/data/useDeleteMany.ts +6 -6
- package/src/hooks/data/useInfiniteList.ts +25 -15
- package/src/hooks/data/useList.ts +20 -10
- package/src/hooks/data/useMany.ts +1 -1
- package/src/hooks/data/useOne.ts +6 -1
- package/src/hooks/data/useUpdate.ts +9 -5
- package/src/hooks/data/useUpdateMany.ts +10 -6
- package/src/hooks/form/useForm.ts +6 -2
- package/src/hooks/show/useShow.ts +8 -3
- package/src/hooks/useSelect/index.ts +6 -1
- package/src/hooks/useTable/index.ts +8 -3
- package/src/interfaces/bindings/auth.ts +5 -3
- package/src/interfaces/errors/RefineError.ts +3 -0
- package/src/interfaces/errors/index.ts +2 -0
- package/src/interfaces/index.ts +1 -1
- package/dist/interfaces/HttpError.d.ts.map +0 -1
- /package/dist/interfaces/{HttpError.d.ts → errors/HttpError.d.ts} +0 -0
- /package/src/interfaces/{HttpError.ts → errors/HttpError.ts} +0 -0
|
@@ -30,21 +30,22 @@
|
|
|
30
30
|
*
|
|
31
31
|
* Same goes for `onError` function, it should always resolve.
|
|
32
32
|
*/
|
|
33
|
+
import { RefineError } from "../errors";
|
|
33
34
|
export declare type CheckResponse = {
|
|
34
35
|
authenticated: boolean;
|
|
35
36
|
redirectTo?: string;
|
|
36
37
|
logout?: boolean;
|
|
37
|
-
error?: Error;
|
|
38
|
+
error?: RefineError | Error;
|
|
38
39
|
};
|
|
39
40
|
export declare type OnErrorResponse = {
|
|
40
41
|
redirectTo?: string;
|
|
41
42
|
logout?: boolean;
|
|
42
|
-
error?: Error;
|
|
43
|
+
error?: RefineError | Error;
|
|
43
44
|
};
|
|
44
45
|
export declare type AuthActionResponse = {
|
|
45
46
|
success: boolean;
|
|
46
47
|
redirectTo?: string;
|
|
47
|
-
error?: Error;
|
|
48
|
+
error?: RefineError | Error;
|
|
48
49
|
[key: string]: unknown;
|
|
49
50
|
};
|
|
50
51
|
export declare type PermissionResponse = unknown;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/interfaces/bindings/auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;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EAAE,GAAG,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC;IAChD,OAAO,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,OAAO,CAAC,eAAe,CAAC,CAAC;IAClD,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,OAAO,CAAC,kBAAkB,CAAC,CAAC;IACxD,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAC9D,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAC9D,cAAc,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,GAAG,KAAK,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAC/D,WAAW,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,GAAG,KAAK,OAAO,CAAC,gBAAgB,CAAC,CAAC;CAC7D,CAAC;AAEF,MAAM,WAAW,oBAAqB,SAAQ,OAAO,CAAC,YAAY,CAAC;IAC/D,UAAU,EAAE,OAAO,CAAC;CACvB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HttpError.d.ts","sourceRoot":"","sources":["../../../src/interfaces/errors/HttpError.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,SAAU,SAAQ,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAClD,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;CACtB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RefineError.d.ts","sourceRoot":"","sources":["../../../src/interfaces/errors/RefineError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,oBAAY,WAAW,GAAG,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/interfaces/errors/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC"}
|
|
@@ -15,7 +15,7 @@ export * from "../components/pages/login";
|
|
|
15
15
|
export * from "./actions";
|
|
16
16
|
export * from "./notification";
|
|
17
17
|
export * from "./mutationMode";
|
|
18
|
-
export * from "./
|
|
18
|
+
export * from "./errors";
|
|
19
19
|
export * from "./customComponents";
|
|
20
20
|
export * from "./resourceRouterParams";
|
|
21
21
|
export * from "./resourceErrorRouterParams";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/interfaces/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGpD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,mCAAmC,CAAC;AAClD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,iDAAiD,CAAC;AAChE,cAAc,uCAAuC,CAAC;AACtD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,0CAA0C,CAAC;AACzD,cAAc,iDAAiD,CAAC;AAChE,cAAc,+CAA+C,CAAC;AAC9D,cAAc,uCAAuC,CAAC;AAEtD,cAAc,2BAA2B,CAAC;AAG1C,cAAc,WAAW,CAAC;AAG1B,cAAc,gBAAgB,CAAC;AAG/B,cAAc,gBAAgB,CAAC;AAG/B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/interfaces/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGpD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,mCAAmC,CAAC;AAClD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,iDAAiD,CAAC;AAChE,cAAc,uCAAuC,C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5.9",
|
|
4
4
|
"description": "refine is a React-based framework for building internal tools, rapidly. It ships with Ant Design System, an enterprise-level UI toolkit.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -9,6 +9,7 @@ import { useAuthBindingsContext, useLegacyAuthContext } from "@contexts/auth";
|
|
|
9
9
|
|
|
10
10
|
import {
|
|
11
11
|
AuthActionResponse,
|
|
12
|
+
RefineError,
|
|
12
13
|
OpenNotificationParams,
|
|
13
14
|
TForgotPasswordData,
|
|
14
15
|
} from "../../../interfaces";
|
|
@@ -16,7 +17,12 @@ import {
|
|
|
16
17
|
export type UseForgotPasswordLegacyProps<TVariables> = {
|
|
17
18
|
v3LegacyAuthProviderCompatible: true;
|
|
18
19
|
mutationOptions?: Omit<
|
|
19
|
-
UseMutationOptions<
|
|
20
|
+
UseMutationOptions<
|
|
21
|
+
TForgotPasswordData,
|
|
22
|
+
Error | RefineError,
|
|
23
|
+
TVariables,
|
|
24
|
+
unknown
|
|
25
|
+
>,
|
|
20
26
|
"mutationFn" | "onError" | "onSuccess"
|
|
21
27
|
>;
|
|
22
28
|
};
|
|
@@ -24,7 +30,12 @@ export type UseForgotPasswordLegacyProps<TVariables> = {
|
|
|
24
30
|
export type UseForgotPasswordProps<TVariables> = {
|
|
25
31
|
v3LegacyAuthProviderCompatible?: false;
|
|
26
32
|
mutationOptions?: Omit<
|
|
27
|
-
UseMutationOptions<
|
|
33
|
+
UseMutationOptions<
|
|
34
|
+
AuthActionResponse,
|
|
35
|
+
Error | RefineError,
|
|
36
|
+
TVariables,
|
|
37
|
+
unknown
|
|
38
|
+
>,
|
|
28
39
|
"mutationFn"
|
|
29
40
|
>;
|
|
30
41
|
};
|
|
@@ -34,7 +45,7 @@ export type UseForgotPasswordCombinedProps<TVariables> = {
|
|
|
34
45
|
mutationOptions?: Omit<
|
|
35
46
|
UseMutationOptions<
|
|
36
47
|
AuthActionResponse | TForgotPasswordData,
|
|
37
|
-
Error,
|
|
48
|
+
Error | RefineError,
|
|
38
49
|
TVariables,
|
|
39
50
|
unknown
|
|
40
51
|
>,
|
|
@@ -44,21 +55,21 @@ export type UseForgotPasswordCombinedProps<TVariables> = {
|
|
|
44
55
|
|
|
45
56
|
export type UseForgotPasswordLegacyReturnType<TVariables> = UseMutationResult<
|
|
46
57
|
TForgotPasswordData,
|
|
47
|
-
Error,
|
|
58
|
+
Error | RefineError,
|
|
48
59
|
TVariables,
|
|
49
60
|
unknown
|
|
50
61
|
>;
|
|
51
62
|
|
|
52
63
|
export type UseForgotPasswordReturnType<TVariables> = UseMutationResult<
|
|
53
64
|
AuthActionResponse,
|
|
54
|
-
Error,
|
|
65
|
+
Error | RefineError,
|
|
55
66
|
TVariables,
|
|
56
67
|
unknown
|
|
57
68
|
>;
|
|
58
69
|
|
|
59
70
|
export type UseForgotPasswordCombinedReturnType<TVariables> = UseMutationResult<
|
|
60
71
|
AuthActionResponse | TForgotPasswordData,
|
|
61
|
-
Error,
|
|
72
|
+
Error | RefineError,
|
|
62
73
|
TVariables,
|
|
63
74
|
unknown
|
|
64
75
|
>;
|
|
@@ -104,7 +115,7 @@ export function useForgotPassword<TVariables = {}>({
|
|
|
104
115
|
|
|
105
116
|
const mutation = useMutation<
|
|
106
117
|
AuthActionResponse,
|
|
107
|
-
Error,
|
|
118
|
+
Error | RefineError,
|
|
108
119
|
TVariables,
|
|
109
120
|
unknown
|
|
110
121
|
>(["useForgotPassword"], forgotPasswordFromContext, {
|
|
@@ -133,7 +144,7 @@ export function useForgotPassword<TVariables = {}>({
|
|
|
133
144
|
|
|
134
145
|
const v3LegacyAuthProviderCompatibleMutation = useMutation<
|
|
135
146
|
TForgotPasswordData,
|
|
136
|
-
Error,
|
|
147
|
+
Error | RefineError,
|
|
137
148
|
TVariables,
|
|
138
149
|
unknown
|
|
139
150
|
>(
|
|
@@ -164,7 +175,9 @@ export function useForgotPassword<TVariables = {}>({
|
|
|
164
175
|
: mutation;
|
|
165
176
|
}
|
|
166
177
|
|
|
167
|
-
const buildNotification = (
|
|
178
|
+
const buildNotification = (
|
|
179
|
+
error?: Error | RefineError,
|
|
180
|
+
): OpenNotificationParams => {
|
|
168
181
|
return {
|
|
169
182
|
message: error?.name || "Forgot Password Error",
|
|
170
183
|
description: error?.message || "Error while resetting password",
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React from "react";
|
|
1
2
|
import {
|
|
2
3
|
useMutation,
|
|
3
4
|
UseMutationOptions,
|
|
@@ -15,15 +16,23 @@ import {
|
|
|
15
16
|
} from "@hooks";
|
|
16
17
|
import { useAuthBindingsContext, useLegacyAuthContext } from "@contexts/auth";
|
|
17
18
|
|
|
18
|
-
import {
|
|
19
|
+
import {
|
|
20
|
+
RefineError,
|
|
21
|
+
OpenNotificationParams,
|
|
22
|
+
TLoginData,
|
|
23
|
+
} from "../../../interfaces";
|
|
19
24
|
import { AuthActionResponse } from "src/interfaces/bindings/auth";
|
|
20
|
-
import React from "react";
|
|
21
25
|
import { useInvalidateAuthStore } from "../useInvalidateAuthStore";
|
|
22
26
|
|
|
23
27
|
export type UseLoginLegacyProps<TVariables> = {
|
|
24
28
|
v3LegacyAuthProviderCompatible: true;
|
|
25
29
|
mutationOptions?: Omit<
|
|
26
|
-
UseMutationOptions<
|
|
30
|
+
UseMutationOptions<
|
|
31
|
+
TLoginData,
|
|
32
|
+
Error | RefineError,
|
|
33
|
+
TVariables,
|
|
34
|
+
unknown
|
|
35
|
+
>,
|
|
27
36
|
"mutationFn" | "onError" | "onSuccess"
|
|
28
37
|
>;
|
|
29
38
|
};
|
|
@@ -31,7 +40,12 @@ export type UseLoginLegacyProps<TVariables> = {
|
|
|
31
40
|
export type UseLoginProps<TVariables> = {
|
|
32
41
|
v3LegacyAuthProviderCompatible?: false;
|
|
33
42
|
mutationOptions?: Omit<
|
|
34
|
-
UseMutationOptions<
|
|
43
|
+
UseMutationOptions<
|
|
44
|
+
AuthActionResponse,
|
|
45
|
+
Error | RefineError,
|
|
46
|
+
TVariables,
|
|
47
|
+
unknown
|
|
48
|
+
>,
|
|
35
49
|
"mutationFn"
|
|
36
50
|
>;
|
|
37
51
|
};
|
|
@@ -41,7 +55,7 @@ export type UseLoginCombinedProps<TVariables> = {
|
|
|
41
55
|
mutationOptions?: Omit<
|
|
42
56
|
UseMutationOptions<
|
|
43
57
|
AuthActionResponse | TLoginData,
|
|
44
|
-
Error,
|
|
58
|
+
Error | RefineError,
|
|
45
59
|
TVariables,
|
|
46
60
|
unknown
|
|
47
61
|
>,
|
|
@@ -51,21 +65,21 @@ export type UseLoginCombinedProps<TVariables> = {
|
|
|
51
65
|
|
|
52
66
|
export type UseLoginLegacyReturnType<TVariables> = UseMutationResult<
|
|
53
67
|
TLoginData,
|
|
54
|
-
Error,
|
|
68
|
+
Error | RefineError,
|
|
55
69
|
TVariables,
|
|
56
70
|
unknown
|
|
57
71
|
>;
|
|
58
72
|
|
|
59
73
|
export type UseLoginReturnType<TVariables> = UseMutationResult<
|
|
60
74
|
AuthActionResponse,
|
|
61
|
-
Error,
|
|
75
|
+
Error | RefineError,
|
|
62
76
|
TVariables,
|
|
63
77
|
unknown
|
|
64
78
|
>;
|
|
65
79
|
|
|
66
80
|
export type UseLoginCombinedReturnType<TVariables> = UseMutationResult<
|
|
67
81
|
AuthActionResponse | TLoginData,
|
|
68
|
-
Error,
|
|
82
|
+
Error | RefineError,
|
|
69
83
|
TVariables,
|
|
70
84
|
unknown
|
|
71
85
|
>;
|
|
@@ -125,7 +139,7 @@ export function useLogin<TVariables = {}>({
|
|
|
125
139
|
|
|
126
140
|
const mutation = useMutation<
|
|
127
141
|
AuthActionResponse,
|
|
128
|
-
Error,
|
|
142
|
+
Error | RefineError,
|
|
129
143
|
TVariables,
|
|
130
144
|
unknown
|
|
131
145
|
>(["useLogin"], loginFromContext, {
|
|
@@ -166,7 +180,7 @@ export function useLogin<TVariables = {}>({
|
|
|
166
180
|
|
|
167
181
|
const v3LegacyAuthProviderCompatibleMutation = useMutation<
|
|
168
182
|
TLoginData,
|
|
169
|
-
Error,
|
|
183
|
+
Error | RefineError,
|
|
170
184
|
TVariables,
|
|
171
185
|
unknown
|
|
172
186
|
>(["useLogin", "v3LegacyAuthProviderCompatible"], legacyLoginFromContext, {
|
|
@@ -206,7 +220,9 @@ export function useLogin<TVariables = {}>({
|
|
|
206
220
|
: mutation;
|
|
207
221
|
}
|
|
208
222
|
|
|
209
|
-
const buildNotification = (
|
|
223
|
+
const buildNotification = (
|
|
224
|
+
error?: Error | RefineError,
|
|
225
|
+
): OpenNotificationParams => {
|
|
210
226
|
return {
|
|
211
227
|
message: error?.name || "Login Error",
|
|
212
228
|
description: error?.message || "Invalid credentials",
|
|
@@ -6,7 +6,11 @@ import {
|
|
|
6
6
|
|
|
7
7
|
import { useGo, useNavigation, useNotification, useRouterType } from "@hooks";
|
|
8
8
|
import { useAuthBindingsContext, useLegacyAuthContext } from "@contexts/auth";
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
RefineError,
|
|
11
|
+
OpenNotificationParams,
|
|
12
|
+
TLogoutData,
|
|
13
|
+
} from "../../../interfaces";
|
|
10
14
|
import { AuthActionResponse } from "src/interfaces/bindings/auth";
|
|
11
15
|
import { useInvalidateAuthStore } from "../useInvalidateAuthStore";
|
|
12
16
|
|
|
@@ -19,7 +23,7 @@ export type UseLogoutLegacyProps<TVariables> = {
|
|
|
19
23
|
mutationOptions?: Omit<
|
|
20
24
|
UseMutationOptions<
|
|
21
25
|
TLogoutData,
|
|
22
|
-
Error,
|
|
26
|
+
Error | RefineError,
|
|
23
27
|
(TVariables & Variables) | void,
|
|
24
28
|
unknown
|
|
25
29
|
>,
|
|
@@ -32,7 +36,7 @@ export type UseLogoutProps<TVariables> = {
|
|
|
32
36
|
mutationOptions?: Omit<
|
|
33
37
|
UseMutationOptions<
|
|
34
38
|
AuthActionResponse,
|
|
35
|
-
Error,
|
|
39
|
+
Error | RefineError,
|
|
36
40
|
(TVariables & Variables) | void,
|
|
37
41
|
unknown
|
|
38
42
|
>,
|
|
@@ -45,7 +49,7 @@ export type UseLogoutCombinedProps<TVariables> = {
|
|
|
45
49
|
mutationOptions?: Omit<
|
|
46
50
|
UseMutationOptions<
|
|
47
51
|
AuthActionResponse | TLogoutData,
|
|
48
|
-
Error,
|
|
52
|
+
Error | RefineError,
|
|
49
53
|
(TVariables & Variables) | void,
|
|
50
54
|
unknown
|
|
51
55
|
>,
|
|
@@ -55,21 +59,21 @@ export type UseLogoutCombinedProps<TVariables> = {
|
|
|
55
59
|
|
|
56
60
|
export type UseLogoutLegacyReturnType<TVariables> = UseMutationResult<
|
|
57
61
|
TLogoutData,
|
|
58
|
-
Error,
|
|
62
|
+
Error | RefineError,
|
|
59
63
|
(TVariables & Variables) | void,
|
|
60
64
|
unknown
|
|
61
65
|
>;
|
|
62
66
|
|
|
63
67
|
export type UseLogoutReturnType<TVariables> = UseMutationResult<
|
|
64
68
|
AuthActionResponse,
|
|
65
|
-
Error,
|
|
69
|
+
Error | RefineError,
|
|
66
70
|
(TVariables & Variables) | void,
|
|
67
71
|
unknown
|
|
68
72
|
>;
|
|
69
73
|
|
|
70
74
|
export type UseLogoutCombinedReturnType<TVariables> = UseMutationResult<
|
|
71
75
|
AuthActionResponse | TLogoutData,
|
|
72
|
-
Error,
|
|
76
|
+
Error | RefineError,
|
|
73
77
|
(TVariables & Variables) | void,
|
|
74
78
|
unknown
|
|
75
79
|
>;
|
|
@@ -108,7 +112,7 @@ export function useLogout<TVariables = {}>({
|
|
|
108
112
|
|
|
109
113
|
const mutation = useMutation<
|
|
110
114
|
AuthActionResponse,
|
|
111
|
-
Error,
|
|
115
|
+
Error | RefineError,
|
|
112
116
|
(TVariables & Variables) | void,
|
|
113
117
|
unknown
|
|
114
118
|
>(["useLogout"], logoutFromContext, {
|
|
@@ -146,7 +150,7 @@ export function useLogout<TVariables = {}>({
|
|
|
146
150
|
|
|
147
151
|
const v3LegacyAuthProviderCompatibleMutation = useMutation<
|
|
148
152
|
TLogoutData,
|
|
149
|
-
Error,
|
|
153
|
+
Error | RefineError,
|
|
150
154
|
(TVariables & Variables) | void,
|
|
151
155
|
unknown
|
|
152
156
|
>(
|
|
@@ -189,7 +193,9 @@ export function useLogout<TVariables = {}>({
|
|
|
189
193
|
: mutation;
|
|
190
194
|
}
|
|
191
195
|
|
|
192
|
-
const buildNotification = (
|
|
196
|
+
const buildNotification = (
|
|
197
|
+
error?: Error | RefineError,
|
|
198
|
+
): OpenNotificationParams => {
|
|
193
199
|
return {
|
|
194
200
|
key: "useLogout-error",
|
|
195
201
|
type: "error",
|
|
@@ -9,6 +9,7 @@ import { useAuthBindingsContext, useLegacyAuthContext } from "@contexts/auth";
|
|
|
9
9
|
|
|
10
10
|
import {
|
|
11
11
|
AuthActionResponse,
|
|
12
|
+
RefineError,
|
|
12
13
|
OpenNotificationParams,
|
|
13
14
|
TLoginData,
|
|
14
15
|
TRegisterData,
|
|
@@ -18,7 +19,12 @@ import { useInvalidateAuthStore } from "../useInvalidateAuthStore";
|
|
|
18
19
|
export type UseRegisterLegacyProps<TVariables> = {
|
|
19
20
|
v3LegacyAuthProviderCompatible: true;
|
|
20
21
|
mutationOptions?: Omit<
|
|
21
|
-
UseMutationOptions<
|
|
22
|
+
UseMutationOptions<
|
|
23
|
+
TRegisterData,
|
|
24
|
+
Error | RefineError,
|
|
25
|
+
TVariables,
|
|
26
|
+
unknown
|
|
27
|
+
>,
|
|
22
28
|
"mutationFn" | "onError" | "onSuccess"
|
|
23
29
|
>;
|
|
24
30
|
};
|
|
@@ -26,7 +32,12 @@ export type UseRegisterLegacyProps<TVariables> = {
|
|
|
26
32
|
export type UseRegisterProps<TVariables> = {
|
|
27
33
|
v3LegacyAuthProviderCompatible?: false;
|
|
28
34
|
mutationOptions?: Omit<
|
|
29
|
-
UseMutationOptions<
|
|
35
|
+
UseMutationOptions<
|
|
36
|
+
AuthActionResponse,
|
|
37
|
+
Error | RefineError,
|
|
38
|
+
TVariables,
|
|
39
|
+
unknown
|
|
40
|
+
>,
|
|
30
41
|
"mutationFn"
|
|
31
42
|
>;
|
|
32
43
|
};
|
|
@@ -36,7 +47,7 @@ export type UseRegisterCombinedProps<TVariables> = {
|
|
|
36
47
|
mutationOptions?: Omit<
|
|
37
48
|
UseMutationOptions<
|
|
38
49
|
AuthActionResponse | TRegisterData,
|
|
39
|
-
Error,
|
|
50
|
+
Error | RefineError,
|
|
40
51
|
TVariables,
|
|
41
52
|
unknown
|
|
42
53
|
>,
|
|
@@ -46,21 +57,21 @@ export type UseRegisterCombinedProps<TVariables> = {
|
|
|
46
57
|
|
|
47
58
|
export type UseRegisterLegacyReturnType<TVariables> = UseMutationResult<
|
|
48
59
|
TRegisterData,
|
|
49
|
-
Error,
|
|
60
|
+
Error | RefineError,
|
|
50
61
|
TVariables,
|
|
51
62
|
unknown
|
|
52
63
|
>;
|
|
53
64
|
|
|
54
65
|
export type UseRegisterReturnType<TVariables> = UseMutationResult<
|
|
55
66
|
AuthActionResponse,
|
|
56
|
-
Error,
|
|
67
|
+
Error | RefineError,
|
|
57
68
|
TVariables,
|
|
58
69
|
unknown
|
|
59
70
|
>;
|
|
60
71
|
|
|
61
72
|
export type UseRegisterCombinedReturnType<TVariables> = UseMutationResult<
|
|
62
73
|
AuthActionResponse | TLoginData,
|
|
63
|
-
Error,
|
|
74
|
+
Error | RefineError,
|
|
64
75
|
TVariables,
|
|
65
76
|
unknown
|
|
66
77
|
>;
|
|
@@ -102,7 +113,7 @@ export function useRegister<TVariables = {}>({
|
|
|
102
113
|
|
|
103
114
|
const mutation = useMutation<
|
|
104
115
|
AuthActionResponse,
|
|
105
|
-
Error,
|
|
116
|
+
Error | RefineError,
|
|
106
117
|
TVariables,
|
|
107
118
|
unknown
|
|
108
119
|
>(["useRegister"], registerFromContext, {
|
|
@@ -137,7 +148,7 @@ export function useRegister<TVariables = {}>({
|
|
|
137
148
|
|
|
138
149
|
const v3LegacyAuthProviderCompatibleMutation = useMutation<
|
|
139
150
|
TRegisterData,
|
|
140
|
-
Error,
|
|
151
|
+
Error | RefineError,
|
|
141
152
|
TVariables,
|
|
142
153
|
unknown
|
|
143
154
|
>(
|
|
@@ -176,7 +187,9 @@ export function useRegister<TVariables = {}>({
|
|
|
176
187
|
: mutation;
|
|
177
188
|
}
|
|
178
189
|
|
|
179
|
-
const buildNotification = (
|
|
190
|
+
const buildNotification = (
|
|
191
|
+
error?: Error | RefineError,
|
|
192
|
+
): OpenNotificationParams => {
|
|
180
193
|
return {
|
|
181
194
|
message: error?.name || "Register Error",
|
|
182
195
|
description: error?.message || "Error while registering",
|
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
import { useAuthBindingsContext, useLegacyAuthContext } from "@contexts/auth";
|
|
18
18
|
import {
|
|
19
19
|
AuthActionResponse,
|
|
20
|
+
RefineError,
|
|
20
21
|
OpenNotificationParams,
|
|
21
22
|
TUpdatePasswordData,
|
|
22
23
|
UpdatePasswordFormTypes,
|
|
@@ -27,7 +28,12 @@ export type UseUpdatePasswordLegacyProps<
|
|
|
27
28
|
> = {
|
|
28
29
|
v3LegacyAuthProviderCompatible: true;
|
|
29
30
|
mutationOptions?: Omit<
|
|
30
|
-
UseMutationOptions<
|
|
31
|
+
UseMutationOptions<
|
|
32
|
+
TUpdatePasswordData,
|
|
33
|
+
Error | RefineError,
|
|
34
|
+
TVariables,
|
|
35
|
+
unknown
|
|
36
|
+
>,
|
|
31
37
|
"mutationFn" | "onError" | "onSuccess"
|
|
32
38
|
>;
|
|
33
39
|
};
|
|
@@ -36,7 +42,12 @@ export type UseUpdatePasswordProps<TVariables extends UpdatePasswordFormTypes> =
|
|
|
36
42
|
{
|
|
37
43
|
v3LegacyAuthProviderCompatible?: false;
|
|
38
44
|
mutationOptions?: Omit<
|
|
39
|
-
UseMutationOptions<
|
|
45
|
+
UseMutationOptions<
|
|
46
|
+
AuthActionResponse,
|
|
47
|
+
Error | RefineError,
|
|
48
|
+
TVariables,
|
|
49
|
+
unknown
|
|
50
|
+
>,
|
|
40
51
|
"mutationFn"
|
|
41
52
|
>;
|
|
42
53
|
};
|
|
@@ -48,7 +59,7 @@ export type UseUpdatePasswordCombinedProps<
|
|
|
48
59
|
mutationOptions?: Omit<
|
|
49
60
|
UseMutationOptions<
|
|
50
61
|
AuthActionResponse | TUpdatePasswordData,
|
|
51
|
-
Error,
|
|
62
|
+
Error | RefineError,
|
|
52
63
|
TVariables,
|
|
53
64
|
unknown
|
|
54
65
|
>,
|
|
@@ -58,17 +69,27 @@ export type UseUpdatePasswordCombinedProps<
|
|
|
58
69
|
|
|
59
70
|
export type UseUpdatePasswordLegacyReturnType<
|
|
60
71
|
TVariables extends UpdatePasswordFormTypes,
|
|
61
|
-
> = UseMutationResult<
|
|
72
|
+
> = UseMutationResult<
|
|
73
|
+
TUpdatePasswordData,
|
|
74
|
+
Error | RefineError,
|
|
75
|
+
TVariables,
|
|
76
|
+
unknown
|
|
77
|
+
>;
|
|
62
78
|
|
|
63
79
|
export type UseUpdatePasswordReturnType<
|
|
64
80
|
TVariables extends UpdatePasswordFormTypes,
|
|
65
|
-
> = UseMutationResult<
|
|
81
|
+
> = UseMutationResult<
|
|
82
|
+
AuthActionResponse,
|
|
83
|
+
Error | RefineError,
|
|
84
|
+
TVariables,
|
|
85
|
+
unknown
|
|
86
|
+
>;
|
|
66
87
|
|
|
67
88
|
export type UseUpdatePasswordCombinedReturnType<
|
|
68
89
|
TVariables extends UpdatePasswordFormTypes,
|
|
69
90
|
> = UseMutationResult<
|
|
70
91
|
AuthActionResponse | TUpdatePasswordData,
|
|
71
|
-
Error,
|
|
92
|
+
Error | RefineError,
|
|
72
93
|
TVariables,
|
|
73
94
|
unknown
|
|
74
95
|
>;
|
|
@@ -169,7 +190,7 @@ export function useUpdatePassword<
|
|
|
169
190
|
|
|
170
191
|
const v3LegacyAuthProviderCompatibleMutation = useMutation<
|
|
171
192
|
TUpdatePasswordData,
|
|
172
|
-
Error,
|
|
193
|
+
Error | RefineError,
|
|
173
194
|
TVariables,
|
|
174
195
|
unknown
|
|
175
196
|
>(
|
|
@@ -205,7 +226,9 @@ export function useUpdatePassword<
|
|
|
205
226
|
: mutation;
|
|
206
227
|
}
|
|
207
228
|
|
|
208
|
-
const buildNotification = (
|
|
229
|
+
const buildNotification = (
|
|
230
|
+
error?: Error | RefineError,
|
|
231
|
+
): OpenNotificationParams => {
|
|
209
232
|
return {
|
|
210
233
|
message: error?.name || "Update Password Error",
|
|
211
234
|
description: error?.message || "Error while updating password",
|
|
@@ -29,7 +29,7 @@ import {
|
|
|
29
29
|
useOnError,
|
|
30
30
|
} from "@hooks";
|
|
31
31
|
|
|
32
|
-
type useCreateParams<TVariables> = {
|
|
32
|
+
type useCreateParams<TData, TError, TVariables> = {
|
|
33
33
|
/**
|
|
34
34
|
* Resource name for API data interactions
|
|
35
35
|
*/
|
|
@@ -55,7 +55,7 @@ type useCreateParams<TVariables> = {
|
|
|
55
55
|
* You can use it to manage the invalidations that will occur at the end of the mutation.
|
|
56
56
|
*/
|
|
57
57
|
invalidates?: Array<keyof IQueryKeys>;
|
|
58
|
-
} & SuccessErrorNotification
|
|
58
|
+
} & SuccessErrorNotification<CreateResponse<TData>, TError, TVariables>;
|
|
59
59
|
|
|
60
60
|
export type UseCreateReturnType<
|
|
61
61
|
TData extends BaseRecord = BaseRecord,
|
|
@@ -64,7 +64,7 @@ export type UseCreateReturnType<
|
|
|
64
64
|
> = UseMutationResult<
|
|
65
65
|
CreateResponse<TData>,
|
|
66
66
|
TError,
|
|
67
|
-
useCreateParams<TVariables>,
|
|
67
|
+
useCreateParams<TData, TError, TVariables>,
|
|
68
68
|
unknown
|
|
69
69
|
>;
|
|
70
70
|
|
|
@@ -77,7 +77,7 @@ export type UseCreateProps<
|
|
|
77
77
|
UseMutationOptions<
|
|
78
78
|
CreateResponse<TData>,
|
|
79
79
|
TError,
|
|
80
|
-
useCreateParams<TVariables>,
|
|
80
|
+
useCreateParams<TData, TError, TVariables>,
|
|
81
81
|
unknown
|
|
82
82
|
>,
|
|
83
83
|
"mutationFn" | "onError" | "onSuccess"
|
|
@@ -125,7 +125,7 @@ export const useCreate = <
|
|
|
125
125
|
const mutation = useMutation<
|
|
126
126
|
CreateResponse<TData>,
|
|
127
127
|
TError,
|
|
128
|
-
useCreateParams<TVariables>,
|
|
128
|
+
useCreateParams<TData, TError, TVariables>,
|
|
129
129
|
unknown
|
|
130
130
|
>(
|
|
131
131
|
({
|
|
@@ -134,7 +134,7 @@ export const useCreate = <
|
|
|
134
134
|
meta,
|
|
135
135
|
metaData,
|
|
136
136
|
dataProviderName,
|
|
137
|
-
}: useCreateParams<TVariables>) => {
|
|
137
|
+
}: useCreateParams<TData, TError, TVariables>) => {
|
|
138
138
|
return dataProvider(
|
|
139
139
|
pickDataProvider(resource, dataProviderName, resources),
|
|
140
140
|
).create<TData, TVariables>({
|
|
@@ -28,14 +28,14 @@ import {
|
|
|
28
28
|
pickNotDeprecated,
|
|
29
29
|
} from "@definitions";
|
|
30
30
|
|
|
31
|
-
type useCreateManyParams<TVariables> = {
|
|
31
|
+
type useCreateManyParams<TData, TError, TVariables> = {
|
|
32
32
|
resource: string;
|
|
33
33
|
values: TVariables[];
|
|
34
34
|
meta?: MetaQuery;
|
|
35
35
|
metaData?: MetaQuery;
|
|
36
36
|
dataProviderName?: string;
|
|
37
37
|
invalidates?: Array<keyof IQueryKeys>;
|
|
38
|
-
} & SuccessErrorNotification
|
|
38
|
+
} & SuccessErrorNotification<CreateManyResponse<TData>, TError, TVariables[]>;
|
|
39
39
|
|
|
40
40
|
export type UseCreateManyReturnType<
|
|
41
41
|
TData extends BaseRecord = BaseRecord,
|
|
@@ -44,7 +44,7 @@ export type UseCreateManyReturnType<
|
|
|
44
44
|
> = UseMutationResult<
|
|
45
45
|
CreateManyResponse<TData>,
|
|
46
46
|
TError,
|
|
47
|
-
useCreateManyParams<TVariables>,
|
|
47
|
+
useCreateManyParams<TData, TError, TVariables>,
|
|
48
48
|
unknown
|
|
49
49
|
>;
|
|
50
50
|
|
|
@@ -57,7 +57,7 @@ export type UseCreateManyProps<
|
|
|
57
57
|
UseMutationOptions<
|
|
58
58
|
CreateManyResponse<TData>,
|
|
59
59
|
TError,
|
|
60
|
-
useCreateManyParams<TVariables>
|
|
60
|
+
useCreateManyParams<TData, TError, TVariables>
|
|
61
61
|
>,
|
|
62
62
|
"mutationFn" | "onError" | "onSuccess"
|
|
63
63
|
>;
|
|
@@ -98,7 +98,7 @@ export const useCreateMany = <
|
|
|
98
98
|
const mutation = useMutation<
|
|
99
99
|
CreateManyResponse<TData>,
|
|
100
100
|
TError,
|
|
101
|
-
useCreateManyParams<TVariables>
|
|
101
|
+
useCreateManyParams<TData, TError, TVariables>
|
|
102
102
|
>(
|
|
103
103
|
({
|
|
104
104
|
resource,
|
|
@@ -106,7 +106,7 @@ export const useCreateMany = <
|
|
|
106
106
|
meta,
|
|
107
107
|
metaData,
|
|
108
108
|
dataProviderName,
|
|
109
|
-
}: useCreateManyParams<TVariables>) => {
|
|
109
|
+
}: useCreateManyParams<TData, TError, TVariables>) => {
|
|
110
110
|
const selectedDataProvider = dataProvider(
|
|
111
111
|
pickDataProvider(resource, dataProviderName, resources),
|
|
112
112
|
);
|