pinafore/src/routes/_actions/onUserIsLoggedOut.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
442 B
JavaScript

// When the user is logged out, we need to be sure to re-show all the "hidden from SSR" styles
// so that we don't get a blank page.
export function onUserIsLoggedOut () {
if (document.getElementById('hiddenFromSsrStyle')) {
return
}
let style = document.createElement('style')
style.setAttribute('id', 'hiddenFromSsrStyle')
style.textContent = '.hidden-from-ssr { opacity: 1 !important; }'
document.head.appendChild(style)
}