Accounts.onLogout to meteor core which corresponds to the already existing
Accounts.onLogin and is called after a
Meteor.logout() call ends.
Log the user out.
Optional callback. Called with no arguments on success, or with a single Error argument on failure.
I have been using this as a pattern for clean ups and custom tasks that need to follow a successful logout event and it has worked out quite okay.
What other use case can we need to have a separate
That’s valid when I’m the one calling the
I’m using other packages which handle signup/signin/signout for me. That means their code is calling
Meteor.logout. I want to be notified when a logout happens, hence the request for
Accounts.createUser accepts a callback, and
Meteor.loginWith* accepts a callback, and
Meteor.logout accepts a callback, but there is no
My specific use is with meteorhacks:flow-router which requires me to write my own tracker to monitor login status. With the addition of
Accounts.onLogout I can hook into that.
Check this out:
You’ll probably find https://atmospherejs.com/differential/event-hooks useful
Thank you for suggesting a package which has a workaround for this issue. I implemented a solution before posting to the forum. Once I needed this missing function it seemed obvious the core API has this hole we code around, so I wanted to mention it in the forum.
is this in core now?
I don’t think so. I’ve got the same situation. I’m surprised they added onLogin with adding onLogout
For such things we used https://github.com/gwendall/meteor-accounts-helpers which was quite helpfully.
Looks like there is an open PR to add an Accounts.onLogout hook.