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
|
||||
})
|
||||
|
|
|
@ -1,13 +1,7 @@
|
|||
import React, { PureComponent } from 'react'
|
||||
|
||||
class Feedback extends PureComponent {
|
||||
render () {
|
||||
return (
|
||||
<div>
|
||||
export default function Feedback (props) {
|
||||
return (
|
||||
<div>
|
||||
hello Feedback
|
||||
</div>
|
||||
)
|
||||
}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default Feedback
|
||||
|
|
|
@ -6,7 +6,6 @@ import Layout from '../components/layout'
|
|||
import constants from '../constants.json'
|
||||
|
||||
export default function UserQuestions (props) {
|
||||
const [loaded, setLoaded] = useState(false)
|
||||
const [qa, setQa] = useState(null)
|
||||
|
||||
useEffect(() => {
|
||||
|
@ -17,11 +16,10 @@ export default function UserQuestions (props) {
|
|||
})
|
||||
.then((data) => {
|
||||
setQa(data)
|
||||
setLoaded(true)
|
||||
})
|
||||
}, [loaded])
|
||||
}, [])
|
||||
|
||||
if (loaded) {
|
||||
if (qa) {
|
||||
let questions = Object.keys(qa).map((key, i) => {
|
||||
let q = qa[key]
|
||||
return (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue