I have run into an issue while trying to update a document with the click of a button. Every time I attempt to update it, an "Internal error" message pops up. The document I am working with is called "confirmed" and it has the capability to store true/false values.
Below is my methods.js
code snippet:
Meteor.methods({
'confirmUser1': function(currUserId) {
var currentUserId = currUserId;
Meteor.users.update(currentUserId, {$set:
{
'confirmed': true
}
});
console.log('user verified!');
}
});
Here's my template events helper:
Template.Users.events({
'click .confirmUser': function(e, tmpl) {
e.preventDefault();
var currentUserId = this._id;
Meteor.call('confirmUser1', currentUserId, function(error) {
if (error) {
alert(error.reason);
} else {
console.log('success!');
Router.go('Admin');
}
});
}
});
The button I am using:
<p><button class="confirmUser">Confirm User</button></p>
Important: I have successfully used similar code for a different update button/method in the past without any issues... so I am puzzled by what might be causing the problem in this specific case.