mirror of
https://gitlab.com/MrFry/qmining-page
synced 2025-04-01 20:23:44 +02:00
Caching fetched resources
This commit is contained in:
parent
7e93e41edc
commit
3daeef184a
12 changed files with 213 additions and 85 deletions
|
@ -22,13 +22,20 @@ function fetchSupportedSites() {
|
|||
})
|
||||
}
|
||||
|
||||
export default function Script() {
|
||||
export default function Script({ globalState, setGlobalState }) {
|
||||
const [supportedSites, setSupportedSites] = useState()
|
||||
|
||||
useEffect(() => {
|
||||
fetchSupportedSites().then((res) => {
|
||||
setSupportedSites(res)
|
||||
})
|
||||
if (globalState.supportedSites) {
|
||||
setSupportedSites(globalState.supportedSites)
|
||||
} else {
|
||||
fetchSupportedSites().then((res) => {
|
||||
setSupportedSites(res)
|
||||
setGlobalState({
|
||||
supportedSites: res,
|
||||
})
|
||||
})
|
||||
}
|
||||
}, [])
|
||||
|
||||
return (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue