@open-tender/utils 0.1.62 → 0.1.63
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { FormFields, RequestError, RequestStatus } from '@open-tender/types';
|
|
3
|
-
export declare const useSendResetForm: (loading: RequestStatus, error: RequestError, sendReset: (email: string, linkUrl: string) =>
|
|
3
|
+
export declare const useSendResetForm: (loading: RequestStatus, error: RequestError, sendReset: (email: string, linkUrl: string) => void, callback?: () => void, windowRef?: Window, linkUrlVal?: string) => {
|
|
4
4
|
submitRef: import("react").MutableRefObject<HTMLButtonElement | null>;
|
|
5
5
|
inputRef: import("react").MutableRefObject<HTMLInputElement | null>;
|
|
6
6
|
fields: FormFields;
|
|
@@ -26,8 +26,11 @@ const useSendResetForm = (loading, error, sendReset, callback, windowRef, linkUr
|
|
|
26
26
|
setErrors(errs);
|
|
27
27
|
((_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus) && ((_b = inputRef.current) === null || _b === void 0 ? void 0 : _b.focus());
|
|
28
28
|
}
|
|
29
|
+
else if (callback) {
|
|
30
|
+
callback();
|
|
31
|
+
}
|
|
29
32
|
}
|
|
30
|
-
}, [loading, error]);
|
|
33
|
+
}, [loading, error, callback]);
|
|
31
34
|
const handleChange = (name, value) => {
|
|
32
35
|
setData(Object.assign(Object.assign({}, data), { [name]: value }));
|
|
33
36
|
};
|
|
@@ -37,10 +40,7 @@ const useSendResetForm = (loading, error, sendReset, callback, windowRef, linkUr
|
|
|
37
40
|
const linkUrl = windowRef
|
|
38
41
|
? `${windowRef.location.origin}/reset-password`
|
|
39
42
|
: `${linkUrlVal}`;
|
|
40
|
-
sendReset(data.email, linkUrl)
|
|
41
|
-
if (callback)
|
|
42
|
-
callback();
|
|
43
|
-
});
|
|
43
|
+
sendReset(data.email, linkUrl);
|
|
44
44
|
((_a = submitRef.current) === null || _a === void 0 ? void 0 : _a.blur) && ((_b = submitRef.current) === null || _b === void 0 ? void 0 : _b.blur());
|
|
45
45
|
};
|
|
46
46
|
return {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { FormFields, RequestError, RequestStatus } from '@open-tender/types';
|
|
3
|
-
export declare const useSendResetForm: (loading: RequestStatus, error: RequestError, sendReset: (email: string, linkUrl: string) =>
|
|
3
|
+
export declare const useSendResetForm: (loading: RequestStatus, error: RequestError, sendReset: (email: string, linkUrl: string) => void, callback?: () => void, windowRef?: Window, linkUrlVal?: string) => {
|
|
4
4
|
submitRef: import("react").MutableRefObject<HTMLButtonElement | null>;
|
|
5
5
|
inputRef: import("react").MutableRefObject<HTMLInputElement | null>;
|
|
6
6
|
fields: FormFields;
|
|
@@ -23,8 +23,11 @@ export const useSendResetForm = (loading, error, sendReset, callback, windowRef,
|
|
|
23
23
|
setErrors(errs);
|
|
24
24
|
((_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus) && ((_b = inputRef.current) === null || _b === void 0 ? void 0 : _b.focus());
|
|
25
25
|
}
|
|
26
|
+
else if (callback) {
|
|
27
|
+
callback();
|
|
28
|
+
}
|
|
26
29
|
}
|
|
27
|
-
}, [loading, error]);
|
|
30
|
+
}, [loading, error, callback]);
|
|
28
31
|
const handleChange = (name, value) => {
|
|
29
32
|
setData(Object.assign(Object.assign({}, data), { [name]: value }));
|
|
30
33
|
};
|
|
@@ -34,10 +37,7 @@ export const useSendResetForm = (loading, error, sendReset, callback, windowRef,
|
|
|
34
37
|
const linkUrl = windowRef
|
|
35
38
|
? `${windowRef.location.origin}/reset-password`
|
|
36
39
|
: `${linkUrlVal}`;
|
|
37
|
-
sendReset(data.email, linkUrl)
|
|
38
|
-
if (callback)
|
|
39
|
-
callback();
|
|
40
|
-
});
|
|
40
|
+
sendReset(data.email, linkUrl);
|
|
41
41
|
((_a = submitRef.current) === null || _a === void 0 ? void 0 : _a.blur) && ((_b = submitRef.current) === null || _b === void 0 ? void 0 : _b.blur());
|
|
42
42
|
};
|
|
43
43
|
return {
|
package/package.json
CHANGED