Picking up meteor.js user logout

前端 未结 6 2022
陌清茗
陌清茗 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:16

    We had a similar, though not exact requirement. We wanted to do a bit of clean up on the client when they signed out. We did it by hijacking Meteor.logout:

    if (Meteor.isClient) {
      var _logout = Meteor.logout;
      Meteor.logout = function customLogout() {
        // Do your thing here
        _logout.apply(Meteor, arguments);
      }
    }
    

提交回复
热议问题