Subject and question browser merge, handling multiple dbs

This commit is contained in:
mrfry 2020-12-26 14:50:39 +01:00
parent 57f0730f3e
commit fb3bf29fc4
11 changed files with 232 additions and 178 deletions

View file

@ -10,6 +10,7 @@ import BB from './b.js'
export default function Layout(props) {
let href = props.route
const [sidebarOpen, setSidebarOpen] = useState(true)
const [userId, setUserId] = useState(null)
if (href === '/' || href === '') {
href = 'index'
@ -23,6 +24,22 @@ export default function Layout(props) {
}
}
useEffect(() => {
closeSideBar()
fetch(`${constants.apiUrl}infos`, {
credentials: 'include',
Accept: 'application/json',
'Content-Type': 'application/json',
})
.then((resp) => {
return resp.json()
})
.then((data) => {
setUserId(data.uid)
})
}, [])
useEffect(() => {
closeSideBar()
}, [])
@ -66,7 +83,7 @@ export default function Layout(props) {
</a>
</Link>
</div>
<div className="userInfo">User # TODO</div>
<div className="userInfo">User #{userId}</div>
</>
) : null}
</div>