forked from polka_billy/porridger
Added useSend hook, converted useFetch to use it
Moved useFetch Related to #19
This commit is contained in:
@ -8,7 +8,7 @@ import { useAddAnnouncement, useTrashboxes } from '../hooks/api'
|
||||
import { handleHTTPErrors } from '../utils'
|
||||
import { categories, categoryNames } from '../assets/category'
|
||||
import { stations, lines, lineNames } from '../assets/metro'
|
||||
import { fallbackError, gotError } from '../hooks/api/useFetch'
|
||||
import { fallbackError, gotError } from '../hooks/useFetch'
|
||||
import { useOsmAddresses } from '../hooks/api'
|
||||
|
||||
const styles = {
|
||||
|
@ -10,7 +10,7 @@ import { Announcement } from '../api/announcement/types'
|
||||
import { categoryGraphics } from '../assets/category'
|
||||
|
||||
import puffSpinner from '../assets/puff.svg'
|
||||
import { gotError } from '../hooks/api/useFetch'
|
||||
import { gotError } from '../hooks/useFetch'
|
||||
|
||||
function generateStories(announcements: Announcement[]): Story[] {
|
||||
return announcements.map(announcement => {
|
||||
@ -63,13 +63,15 @@ const styles = {
|
||||
}
|
||||
|
||||
function HomePage() {
|
||||
const { height, width } = useStoryDimensions(16 / 10)
|
||||
const { height, width } = useStoryDimensions(16 / 9)
|
||||
|
||||
const [filterShown, setFilterShown] = useState(false)
|
||||
const [filter, setFilter] = useState(defaultFilters)
|
||||
|
||||
const announcementsFetch = useAnnouncements(filter)
|
||||
|
||||
// console.log(announcementsFetch)
|
||||
|
||||
const stories = fallbackGenerateStories(announcementsFetch)
|
||||
|
||||
return (<>
|
||||
|
@ -28,7 +28,7 @@ function LoginPage() {
|
||||
|
||||
if (token) {
|
||||
setToken(token)
|
||||
navigate('/')
|
||||
navigate(-1 - Number(import.meta.env.DEV))
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user