Hello everyone!
I’m developing an app in Meteor and I want to know how I do can delete a user’s account who is logged into the system? I mean that you can delete your account (like Tinder or Facebook) and the application ejects you because you’re already deleted, and you no longer exist.
With a simple button of “Delete your account” attached.
If you could help me; I’m still a novice I’d really appreciate it, I try to retrieve the id of the current user with Meteor.userId(), and I was creating a method in the following way:
Meteor.methods({
SuprimirPersona: function(id) {
var postId = Meteor.userId();
console.log("id users ",id);
Meteor.users.remove({ postId: id })
},
});
And calling the method in the following way but it does not give any results, I do not understand why:
‘click #Desactivarr’: function() {
var postId = Meteor.userId();
Meteor.call(‘SuprimirPersona’, postId, function(error, result) {
if (error) {
console.log(“Somee Error”,error);
}
});
Meteor.logout(function() {
FlowRouter.go(‘/’);
});
},
Hope someone could help me! Regards!