convert promise to async await
This commit is contained in:
parent
6553a44e45
commit
ba0d641868
|
@ -60,11 +60,11 @@ const AddDomain = withFormik({
|
||||||
if (!domainName) errors.domainName = 'Required';
|
if (!domainName) errors.domainName = 'Required';
|
||||||
return errors;
|
return errors;
|
||||||
},
|
},
|
||||||
handleSubmit(values, { setSubmitting }) {
|
async handleSubmit(values, { setSubmitting }) {
|
||||||
const { domainName, domainPrice } = values
|
const { domainName, domainPrice } = values
|
||||||
const { methods: { domains, addDomain, setDomainPrice } } = ENSSubdomainRegistry
|
const { methods: { domains, addDomain, setDomainPrice } } = ENSSubdomainRegistry
|
||||||
const hashedDomain = hash(domainName);
|
const hashedDomain = hash(domainName);
|
||||||
getDomain(hashedDomain, domains).then(({ state }) => {
|
const { state } = await getDomain(hashedDomain, domains);
|
||||||
setPrice(
|
setPrice(
|
||||||
!!state ? setDomainPrice : addDomain,
|
!!state ? setDomainPrice : addDomain,
|
||||||
hashedDomain,
|
hashedDomain,
|
||||||
|
@ -78,7 +78,6 @@ const AddDomain = withFormik({
|
||||||
setSubmitting(false);
|
setSubmitting(false);
|
||||||
console.log(err);
|
console.log(err);
|
||||||
})
|
})
|
||||||
})
|
|
||||||
}
|
}
|
||||||
})(InnerForm)
|
})(InnerForm)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue