Skip to content

Reset current user pointer when the object is destroyed #169

@mescalito

Description

@mescalito

Why a {code: 209, error: "invalid session token"} after a user.destroy and then singUp() a new user?

$scope.doesNotExist = function (value) {
            var db = ['john.doe@mail.com', 'jane.doe@mail.com'];

            var deferral = $q.defer();
            var user = new Parse.User();
            user.set("username", "clave9");
            user.set("password", "my pass");
            user.signUp(null, {
                success: function(user) {
                    // Hooray! Let them use the app now.
                    console.log("success!");
                    //resolve();
                    // holly shit! now I have to destroy the error and wait for the whole form to be submmited.
                    user.destroy({
                        success: function(myObject) {
                            // The object was deleted from the Parse Cloud.
                            console.log("destroy!!!!!!!!!!!");
                            deferral.resolve();
                        },
                        error: function(myObject, error) {
                            // The delete failed.
                            // error is a Parse.Error with an error code and message.
                            console.log("failed destroy!!!!!!!!!!!");
                            deferral.resolve();
                        }
                    });
                    Parse.User.logOut();
                    deferral.resolve();
                },
                error: function(user, error) {
                    // Show the error message somewhere and let the user try again.
                    console.log("Errrrrror: " + error.code + " " + error.message);
                    //reject();
                    deferral.reject("AUTH_REQUIRED");
                }
            });
            return deferral.promise;
        };

This issue is related to this question in StackOverflow: http://stackoverflow.com/questions/34823496/how-do-i-check-if-a-username-is-taken-with-parse-com-when-all-user-aclpublic-re

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:featureNew feature or improvement of existing feature

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions