pinafore/src/routes/_store/observers/logOutObservers.js
Nolan Lawson bf9ba22c35
fix: fix logging in and out with a refresh (#824)
* fix: fix logging in and out with a refresh

fixes #805

* simplify code

* make test less flaky

* fix dumb mistake
2018-12-16 12:39:16 -08:00

12 lines
273 B
JavaScript

import { onUserIsLoggedOut } from '../../_actions/onUserIsLoggedOut'
export function logOutObservers (store) {
if (!process.browser) {
return
}
store.observe('isUserLoggedIn', isUserLoggedIn => {
if (!isUserLoggedIn) {
onUserIsLoggedOut()
}
})
}