Picking up meteor.js user logout

前端 未结 6 2032
陌清茗
陌清茗 2020-12-30 01:52

Is there any way to pick up when a user logs out of the website? I need to do some clean up when they do so. Using the built-in meteor.js user accounts.

I\'ll be doi

6条回答
  •  不知归路
    2020-12-30 02:12

    None of the solutions worked for me, since they all suffered from the problem of not being able to distinguish between manual logout by the user vs. browser page reload/close.

    I'm now going with a hack, but at least it works (as long as you don't provide any other means of logging out than the default accounts-ui buttons):

    Template._loginButtons.events({
        'click #login-buttons-logout': function(ev) {
            console.log("manual log out");
            // do stuff
        }
    });
    

提交回复
热议问题