convert promise to async await

This commit is contained in:
Barry Gitarts 2018-05-25 11:39:11 -04:00
parent 6553a44e45
commit ba0d641868
1 changed files with 15 additions and 16 deletions

View File

@ -60,11 +60,11 @@ const AddDomain = withFormik({
if (!domainName) errors.domainName = 'Required';
return errors;
},
handleSubmit(values, { setSubmitting }) {
async handleSubmit(values, { setSubmitting }) {
const { domainName, domainPrice } = values
const { methods: { domains, addDomain, setDomainPrice } } = ENSSubdomainRegistry
const hashedDomain = hash(domainName);
getDomain(hashedDomain, domains).then(({ state }) => {
const { state } = await getDomain(hashedDomain, domains);
setPrice(
!!state ? setDomainPrice : addDomain,
hashedDomain,
@ -78,7 +78,6 @@ const AddDomain = withFormik({
setSubmitting(false);
console.log(err);
})
})
}
})(InnerForm)