Okay, that’s an improvement regarding formatting for sure but quite a bit of it is still a bit confusing. I don’t know anything about parse, or what or why a 101 error code is, but my first question is does that success block actually run? Put a breakpoint in there and see
Because looking at your code, on successful login you do absolutely nothing, but on error, if that error is 101(?), save the user returned in the error (?), and if that save of the user returned in the error is successful…then run your redirect.
Just looking at that makes zero sense to me, maybe something with that Parse library, no idea. But check if that block of code even runs. My guess is no.
goConfirm(caddados: Usuario){
var user = new Parse.User();
user.set("username", caddados.nome);
user.set("password", caddados.senha);
user.set("email", caddados.email);
user.signUp( {
success: function(user) {
// Hooray! Let them use the app now.
this.navCtrl.push(TabsPage); <--- Don't Works
},
error: function(user, error) {
// Show the error message somewhere and let the user try again.
alert("Error: " + error.code + " " + error.message);
}
});
Well, I have to guess this is something to do with how Parse works then, so I can’t gaurantee an answer for you, since I don’t use it. But I’d recommend you switch away from whatever magic parse thinks it’s doing and use their promise syntax (although based on their docs it seems like they might use their onw promise implementation). Try something like this, I have no idea if this will wokr though.
Ya, that’s exactly what I said at the end of my comment, your logIn function doesn’t return a promise. So…you would also have to change that to return a promise. Idk what your login function does so hard for me to advise you any further on that without knowing what that does
For those wondering, the ‘this’ in your success callback does not refer to the instance of LoginPage and thus does not have access to the navCtrl. The reason your ‘.then()’ callback works is because it uses the fat arrow syntax which auto binds ‘this’ to the instance of LoginPage.