mirror of
https://gitlab.com/MrFry/qmining-page
synced 2025-04-01 20:23:44 +02:00
allquestions dbs cache fix, minor style changes
This commit is contained in:
parent
14d8e43083
commit
1337bcdd1a
5 changed files with 15 additions and 10 deletions
|
@ -57,7 +57,6 @@ function fetchAllData(dbs) {
|
|||
|
||||
function fetchDbs() {
|
||||
return new Promise((resolve) => {
|
||||
console.info('Fetching data')
|
||||
fetch(`${constants.apiUrl}getDbs`, {
|
||||
credentials: 'include',
|
||||
})
|
||||
|
@ -86,9 +85,16 @@ export default function AllQuestions({ router, globalState, setGlobalState }) {
|
|||
router.replace(`${router.asPath.replace('.html', '')}`, undefined, {
|
||||
shallow: true,
|
||||
})
|
||||
fetchDbs().then((res) => {
|
||||
setDbs(res)
|
||||
})
|
||||
if (globalState.qdbs) {
|
||||
setDbs(globalState.qdbs)
|
||||
} else {
|
||||
fetchDbs().then((res) => {
|
||||
setDbs(res)
|
||||
setGlobalState({
|
||||
qdbs: res,
|
||||
})
|
||||
})
|
||||
}
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue