mirror of
https://github.com/elyby/accounts-frontend.git
synced 2025-05-31 14:11:58 +05:30
Change prettier rules
This commit is contained in:
@@ -8,54 +8,50 @@ import MfaDisableForm from './disableForm/MfaDisableForm';
|
||||
import MfaStatus from './status/MfaStatus';
|
||||
|
||||
export default class MfaDisable extends React.Component<
|
||||
{
|
||||
onSubmit: (form: FormModel, sendData: () => Promise<void>) => Promise<void>;
|
||||
onComplete: () => void;
|
||||
},
|
||||
{
|
||||
showForm: boolean;
|
||||
}
|
||||
{
|
||||
onSubmit: (form: FormModel, sendData: () => Promise<void>) => Promise<void>;
|
||||
onComplete: () => void;
|
||||
},
|
||||
{
|
||||
showForm: boolean;
|
||||
}
|
||||
> {
|
||||
static contextType = Context;
|
||||
/* TODO: use declare */ context: React.ContextType<typeof Context>;
|
||||
static contextType = Context;
|
||||
/* TODO: use declare */ context: React.ContextType<typeof Context>;
|
||||
|
||||
state = {
|
||||
showForm: false,
|
||||
};
|
||||
state = {
|
||||
showForm: false,
|
||||
};
|
||||
|
||||
render() {
|
||||
const { showForm } = this.state;
|
||||
render() {
|
||||
const { showForm } = this.state;
|
||||
|
||||
return showForm ? (
|
||||
<MfaDisableForm onSubmit={this.onSubmit} />
|
||||
) : (
|
||||
<MfaStatus onProceed={this.onProceed} />
|
||||
);
|
||||
}
|
||||
return showForm ? <MfaDisableForm onSubmit={this.onSubmit} /> : <MfaStatus onProceed={this.onProceed} />;
|
||||
}
|
||||
|
||||
onProceed = () => this.setState({ showForm: true });
|
||||
onProceed = () => this.setState({ showForm: true });
|
||||
|
||||
onSubmit = (form: FormModel) => {
|
||||
return this.props
|
||||
.onSubmit(form, () => {
|
||||
const { totp, password } = form.serialize() as {
|
||||
totp: string;
|
||||
password?: string;
|
||||
};
|
||||
onSubmit = (form: FormModel) => {
|
||||
return this.props
|
||||
.onSubmit(form, () => {
|
||||
const { totp, password } = form.serialize() as {
|
||||
totp: string;
|
||||
password?: string;
|
||||
};
|
||||
|
||||
return disableMFA(this.context.userId, totp, password);
|
||||
})
|
||||
.then(() => this.props.onComplete())
|
||||
.catch((resp) => {
|
||||
const { errors } = resp || {};
|
||||
return disableMFA(this.context.userId, totp, password);
|
||||
})
|
||||
.then(() => this.props.onComplete())
|
||||
.catch((resp) => {
|
||||
const { errors } = resp || {};
|
||||
|
||||
if (errors) {
|
||||
return Promise.reject(errors);
|
||||
}
|
||||
if (errors) {
|
||||
return Promise.reject(errors);
|
||||
}
|
||||
|
||||
logger.error('MFA: Unexpected disable form result', {
|
||||
resp,
|
||||
});
|
||||
});
|
||||
};
|
||||
logger.error('MFA: Unexpected disable form result', {
|
||||
resp,
|
||||
});
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user