Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (me) {
box.appendChild(logoutButton(me, options))
} else {
box.appendChild(signInOrSignUpBox(dom, setIt, options))
}
}
box.me = me ? me.uri : null
},
err => {
alert(`loginStatusBox: ${err}`)
}
)
}
if (solidAuthClient.trackSession) {
solidAuthClient.trackSession(session => {
if (session && session.webId) {
me = $rdf.sym(session.webId)
} else {
me = null
}
box.refresh()
})
}
box.me = '99999' // Force refresh
box.refresh()
return box
}
*/
export default function useWebId(reducer = getWebId) {
const [result, updateWebId] = useReducer(reducer, webId, reducer);
useDebugValue(webId);
useEffect(() => {
updateWebId(webId);
subscribers.add(updateWebId);
return () => subscribers.delete(updateWebId);
}, []);
return result;
}
// Inform subscribers when the WebID changes
auth.trackSession(session => {
webId = session ? session.webId : null;
for (const subscriber of subscribers)
subscriber(webId);
});