mirror of
https://gitlab.com/MrFry/qmining-page
synced 2025-04-01 20:23:44 +02:00
Subject and question browser merge, handling multiple dbs
This commit is contained in:
parent
57f0730f3e
commit
fb3bf29fc4
11 changed files with 232 additions and 178 deletions
|
@ -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>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue