mirror of https://github.com/vector-im/riot-web
Convert 3PID lookup in preview bar to async / await
parent
18c4ece87a
commit
244b613623
|
@ -104,21 +104,21 @@ module.exports = React.createClass({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_checkInvitedEmail: function() {
|
_checkInvitedEmail: async function() {
|
||||||
// If this is an invite and we've been told what email
|
// If this is an invite and we've been told what email
|
||||||
// address was invited, fetch the user's list of Threepids
|
// address was invited, fetch the user's list of Threepids
|
||||||
// so we can check them against the one that was invited
|
// so we can check them against the one that was invited
|
||||||
if (this.props.inviterName && this.props.invitedEmail) {
|
if (this.props.inviterName && this.props.invitedEmail) {
|
||||||
this.setState({busy: true});
|
this.setState({busy: true});
|
||||||
MatrixClientPeg.get().lookupThreePid(
|
try {
|
||||||
'email', this.props.invitedEmail,
|
const result = await MatrixClientPeg.get().lookupThreePid(
|
||||||
).finally(() => {
|
'email', this.props.invitedEmail,
|
||||||
this.setState({busy: false});
|
);
|
||||||
}).done((result) => {
|
|
||||||
this.setState({invitedEmailMxid: result.mxid});
|
this.setState({invitedEmailMxid: result.mxid});
|
||||||
}, (err) => {
|
} catch (err) {
|
||||||
this.setState({threePidFetchError: err});
|
this.setState({threePidFetchError: err});
|
||||||
});
|
}
|
||||||
|
this.setState({busy: false});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue