Session doesn't work

Hello

I define session in my project but it doesn’t work and I keep getting this error in console:
session is not defined.

Here is my code:

 Template.leaderboard.events({
        'click.player': function () {
          
            var playerId = this._id;
            Session.set('selectedPlayer', playerId);
                  }
    })

Can you please let me know what is wrong?

thanks
Saeed

How did you “define session in my project”?

Did you try meteor add session?

1 Like

You mean which I used is wrong and is not supported any more and i should use meteor add session function?

Session is a package. It needs adding (with meteor add session) before it can be used.

1 Like