Is it possible to replace the below code with async
and await
:
loadCurrentUser() {
this.get('flashMessages').clearMessages();
if (this.get('session.isAuthenticated')) {
return this.get('store').queryRecord('user', { me: true }).then((user) => {
this.get('flashMessages').success(this.get('i18n').t('flash.signed_in'));
this.set('user', user);
});
} else {
this.get('flashMessages').info(this.get('i18n').t('flash.signed_off'));
return RSVP.resolve();
}
Thank you.