Typo fix, index minor fixes

This commit is contained in:
mrfry 2022-04-02 15:06:43 +02:00
parent 26ae1bc2bb
commit e15bc6a782
2 changed files with 22 additions and 16 deletions

View file

@ -83,7 +83,7 @@ function fetchLeaderboard() {
resolve(res)
})
})
})
}, { staleTime: Infinity })
return data || []
}
@ -190,21 +190,27 @@ const NewsEntryContainer = ({
onTitleClick,
}) => {
const [error, setError] = useState(false)
if (!newsEntryData && !error) {
fetchEntry(postKey)
.then((res) => {
const { success, entry, msg } = res
if (success) {
setNews({ [postKey]: entry, ...news })
} else {
alert(msg)
useEffect(() => {
if (!newsEntryData && !error) {
fetchEntry(postKey)
.then((res) => {
const { success, entry, msg } = res
if (success) {
setNews({ [postKey]: entry, ...news })
} else {
alert(msg)
setError(true)
}
})
.catch((e) => {
console.error(e)
setError(true)
}
})
.catch((e) => {
console.error(e)
setError(true)
})
})
}
}, [])
if (!newsEntryData) {
return <LoadingIndicator />
}

View file

@ -9,7 +9,7 @@ import ExternalLinkIcon from '../components/externalLinkIcon'
import styles from './script.module.css'
function fetchSurouter.pathnamepportedSites() {
function fetchSupportedSites() {
return new Promise((resolve) => {
fetch(`${constants.apiUrl}supportedSites`, {
credentials: 'include',