mirror of
https://gitlab.com/MrFry/qmining-page
synced 2025-04-01 20:23:44 +02:00
Added tabs.json
This commit is contained in:
parent
b7dcc360bc
commit
8a1149d223
5 changed files with 39 additions and 40 deletions
|
@ -10,11 +10,9 @@ import constants from '../constants.json'
|
|||
|
||||
export default function AllQuestions (props) {
|
||||
const [data, setData] = useState(null)
|
||||
const [loaded, setLoaded] = useState(false)
|
||||
const [activeSubjName, setActiveSubjName] = useState('')
|
||||
const [searchTerm, setSearchTerm] = useState('')
|
||||
|
||||
// TODO: fetches twice
|
||||
useEffect(() => {
|
||||
console.info('Fetching data')
|
||||
fetch(`${constants.serverUrl}data.json`)
|
||||
|
@ -23,11 +21,10 @@ export default function AllQuestions (props) {
|
|||
})
|
||||
.then((data) => {
|
||||
setData(data)
|
||||
setLoaded(true)
|
||||
})
|
||||
}, [loaded])
|
||||
}, [])
|
||||
|
||||
if (loaded) {
|
||||
if (data) {
|
||||
let currSubj = data.Subjects.find((subj) => {
|
||||
return subj.Name === activeSubjName
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue