hi,
i trying get the userid in the server side whit Meteor.methods() , But I’m still getting undefined.
I simply want to get the userId () to be able to stop the reminder in which I am working.
In my other methods it works using insert and udapte so I can not understand why I keep getting undefenied
The code is as follows.
import moment from 'moment';
import { Meteor } from 'meteor/meteor';
Meteor.methods({
timer1: function(timer){
console.log("metodos Timer");
console.log(timer);
var id= Meteor.userId();
console.log('id:',id);
var data = AddPerson.find({ userId: "3aNo4by6miwqdN2Qv"}).fetch();
l = data.length;
console.log('data-l',l);
for (var i = 0; i < data.length; i++) {
console.log(data[i].hora)
var timer2 = moment(timer).format('HH:mm');
console.log('timer2:',timer2);
if (timer2 === data[i].hora){
console.log("STOP")
SyncedCron.stop();
} else {
console.log('contando.');
console.log('contando..');
console.log('contando...');
}
}
}
})