I have a problem with the following chain of promises:
Parse.Cloud.run('cloudlogin', {
fb_accessToken: $localStorage.accessTokenFacebook
, facebookID: FACEBOOKID
}, {
success: function (userdata) {
alert(JSON.stringify(userdata))
$localStorage.username = userdata.username;
$localStorage.password = userdata.password;
$localStorage.fb_access_token = userdata.fb_accessToken;
var bool = userdata.isnewuser
alert('bool' + bool)
return bool
}
, error: function (error) {
alert(error)
$state.go("login")
.then(function () {
$ionicLoading.hide()
})
}
})
.then(function (isnewuser) {
$localStorage.organizerAccess = true;
alert('fbdata' + JSON.stringify(isnewuser))
})
I would like to make the first promise to return the boolean 'isnewuser' to the second promise but instead the whole 'userdata' object is returned. Any idea?