Skip to content

Commit

Permalink
fix(login): Fetching account infos now reads "Loading your dashboard"…
Browse files Browse the repository at this point in the history
… instead of logging you in

Fixes #105
  • Loading branch information
MathieuNls committed Mar 14, 2017
1 parent 4fe13d9 commit a751a01
Showing 1 changed file with 23 additions and 16 deletions.
39 changes: 23 additions & 16 deletions src/pages/login/login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,24 +213,31 @@ export class LogInPage extends LoginComponent{
* user from the API
*/
private initOnResume(){
console.log("resime");
document.addEventListener('resume', () => {

this.fetchUser().then(
user => {
DashboardPage.userChanged.emit(user)
this.loginAttempt.emit(false);
},
error => {
this.loginAttempt.emit(false);

//In case the user were on the signup page, let him be
//https://github.com/Toolwatchapp/tw-mobile/issues/98
if(this.nav.getActive().name != "SignupPage"){
this.nav.setRoot(LogInPage);
}
}
);

if(this.nav.getActive().name != "SignupPage" || this.nav.getActive().name != "LoginPage"){

this.translate.get('loading-dashboard').subscribe(
sentenceLoading => {

let laodingDashboard = this.loadingController.create({content: sentenceLoading})
laodingDashboard.present();

this.fetchUser().then(
user => {
this.onSuccessLogging(user)
laodingDashboard.dismiss();
},
error => {
this.nav.setRoot(LogInPage);
laodingDashboard.dismiss();
}
);
}
);
}

TwAPIService.resetTime();
});
}
Expand Down

0 comments on commit a751a01

Please sign in to comment.