/* global React */
(function () {
const { useState, useEffect } = React;
function App() {
const [authed, setAuthed] = useState(window.SC_Auth.isAuthed());
useEffect(() => {
const onLogin = () => setAuthed(true);
const onLogout = () => setAuthed(false);
window.addEventListener('sc:login', onLogin);
window.addEventListener('sc:logout', onLogout);
return () => {
window.removeEventListener('sc:login', onLogin);
window.removeEventListener('sc:logout', onLogout);
};
}, []);
if (!authed) return ;
return ;
}
window.App = App;
})();