Skip to content

Commit

Permalink
Merge pull request #37 from devdanielsun/developer
Browse files Browse the repository at this point in the history
Fix showing error message
  • Loading branch information
devdanielsun authored Feb 3, 2024
2 parents a79fb7e + efbfd43 commit d426dc8
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 12 deletions.
5 changes: 3 additions & 2 deletions pollor.client/src/app/polls/polls.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@ export class PollsComponent {
this.pollsLoaded = true;
},
error: (err) => {
this.pollLoadingMsg = err.status + ' - ' + err.error.message;
const msg = (err.error.message ? err.error.message : err.message);
this.pollLoadingMsg = err.status + ' - ' + msg;
this.pollLoadingColor = "red";
console.error(err);
AlertMessage.addErrorAlert(err.error.message);
AlertMessage.addErrorAlert(msg);
},
//complete: () => { }
});
Expand Down
10 changes: 6 additions & 4 deletions pollor.client/src/app/user-login/user-login.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,10 @@ export class UserLoginComponent {
AlertMessage.addSuccessAlert("Login is successfull !");
},
error: (err: any) => {
this.loginError = err.error.message;
const msg = (err.error.message ? err.error.message : err.message);
this.loginError = err.status + ' - ' + msg;
console.error('Login Error:', err);
AlertMessage.addErrorAlert(err.error.message);
AlertMessage.addErrorAlert(msg);
},
});
}
Expand All @@ -79,9 +80,10 @@ export class UserLoginComponent {
this.navigateDashboard(res.user.role);
},
error: (err: any) => {
this.loginError = err.error.message;
const msg = (err.error.message ? err.error.message : err.message);
this.loginError = err.status + ' - ' + msg;
console.error('Token validation Error:', err);
AlertMessage.addErrorAlert(err.error.message);
AlertMessage.addErrorAlert(msg);
},
});
}
Expand Down
5 changes: 3 additions & 2 deletions pollor.client/src/app/user-profile/user-profile.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,10 @@ export class UserProfileComponent {
this.userLoaded = true;
},
error: (err) => {
this.userLoadingMsg = err.status + ' - ' + err.error.message;
const msg = (err.error.message ? err.error.message : err.message);
this.userLoadingMsg = err.status + ' - ' + msg;
console.error(err);
AlertMessage.addErrorAlert(err.error.message);
AlertMessage.addErrorAlert(msg);
},
//complete: () => { }
});
Expand Down
10 changes: 6 additions & 4 deletions pollor.client/src/app/user-register/user-register.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,10 @@ export class UserRegisterComponent {
AlertMessage.addSuccessAlert("Account registration is successfull !");
},
error: (err: any) => {
this.registerError = err.error.message;
const msg = (err.error.message ? err.error.message : err.message);
this.registerError = err.status + ' - ' + msg;
console.error('Login Error:', err);
AlertMessage.addErrorAlert(err.error.message);
AlertMessage.addErrorAlert(msg);
},
});
}
Expand All @@ -88,9 +89,10 @@ export class UserRegisterComponent {
this.navigateDashboard(res.user.role);
},
error: (err: any) => {
this.registerError = err.error.message;
const msg = (err.error.message ? err.error.message : err.message);
this.registerError = err.status + ' - ' + msg;
console.error('Token validation Error:', err);
AlertMessage.addErrorAlert(err.error.message);
AlertMessage.addErrorAlert(msg);
},
});
}
Expand Down

0 comments on commit d426dc8

Please sign in to comment.