Clean up some loading stuff

This commit is contained in:
Matthew Dillon 2015-07-17 07:32:53 -08:00
parent 1bb5dc67b2
commit fb57534b64
3 changed files with 15 additions and 18 deletions

View file

@ -7,13 +7,13 @@ export default Ember.Controller.extend({
let session = this.get('session');
let authenticator = 'simple-auth-authenticator:token';
this.set('loading', true);
// Manually clean up because there might not be a transition
this.get('flashMessages').clearMessages();
this.transitionTo('loading').then(() => {
session.authenticate(authenticator, credentials).then(null, (error)=> {
this.set('loading', false);
this.get('flashMessages').error(error.error);
});
});
}
}
});

View file

@ -1,7 +1,4 @@
{{#x-application invalidateSession="invalidateSession"}}
{{#if loading}}
{{loading-panel}}
{{else}}
<form {{action "authenticate" on="submit"}}>
<h2>Log In</h2>
{{input value=identification type="text" placeholder="Email"}}
@ -12,5 +9,4 @@
<div>
Forget your password? {{link-to 'Request a lockout email.' 'users.requestlockouthelp'}}
</div>
{{/if}}
{{/x-application}}

View file

@ -0,0 +1 @@
{{loading-panel}}