A few react-admin upgrades

as per https://marmelab.com/react-admin/Upgrade.html
This commit is contained in:
Abel Luck 2023-06-07 12:14:12 +00:00
parent cdccc7f062
commit 49650795df
6 changed files with 41 additions and 34 deletions

View file

@ -138,7 +138,7 @@ const handleRequestCode = async ({
verifyMode,
id,
onSuccess,
onFailure,
onError,
captchaCode = undefined,
}: any) => {
if (verifyMode === MODE.SMS) console.log("REQUESTING sms");
@ -160,7 +160,7 @@ const handleRequestCode = async ({
if (response && response.ok) {
onSuccess();
} else {
onFailure(response.status || 400);
onError(response.status || 400);
}
} catch (error: any) {
console.error("Failed to request verification code:", error);
@ -171,7 +171,7 @@ const VerificationCodeRequest = ({
verifyMode,
data,
onSuccess,
onFailure,
onError,
}: any) => {
React.useEffect(() => {
(async () => {
@ -179,10 +179,10 @@ const VerificationCodeRequest = ({
verifyMode,
id: data.id,
onSuccess,
onFailure,
onError,
});
})();
}, [data.id, onFailure, onSuccess, verifyMode]);
}, [data.id, onError, onSuccess, verifyMode]);
return (
<>
@ -204,7 +204,7 @@ const VerificationCaptcha = ({
verifyMode,
data,
onSuccess,
onFailure,
onError,
handleClose,
}: any) => {
const [code, setCode] = React.useState(undefined);
@ -216,7 +216,7 @@ const VerificationCaptcha = ({
verifyMode,
id: data.id,
onSuccess,
onFailure,
onError,
captchaCode: code,
});
setSubmitting(false);
@ -367,7 +367,7 @@ const VerificationCodeDialog = (props: any) => {
props.handleClose();
};
const onFailure = (code: number) => {
const onError = (code: number) => {
if (code === 402 || code === 500) {
setStage("captcha");
} else {
@ -385,7 +385,7 @@ const VerificationCodeDialog = (props: any) => {
<VerificationCodeRequest
mode={props.verifyMode}
onSuccess={onRequestSuccess}
onFailure={onFailure}
onError={onError}
{...props}
/>
)}
@ -400,7 +400,7 @@ const VerificationCodeDialog = (props: any) => {
<VerificationCaptcha
mode={props.verifyMode}
onSuccess={onRequestSuccess}
onFailure={onRestartVerification}
onError={onRestartVerification}
handleClose={handleClose}
{...props}
/>