Fixed trashbox request causing constant rerenders
This commit is contained in:
parent
b7bbd937b4
commit
1c25d66027
@ -1,6 +1,7 @@
|
|||||||
import { LatLng } from 'leaflet'
|
import { LatLng } from 'leaflet'
|
||||||
|
|
||||||
import { API_URL } from '../../config'
|
import { API_URL } from '../../config'
|
||||||
|
import { Trashbox, TrashboxResponse } from './types'
|
||||||
|
|
||||||
const composeTrashboxURL = (position: LatLng) => (
|
const composeTrashboxURL = (position: LatLng) => (
|
||||||
API_URL + '/trashbox?' + new URLSearchParams({
|
API_URL + '/trashbox?' + new URLSearchParams({
|
||||||
@ -9,4 +10,7 @@ const composeTrashboxURL = (position: LatLng) => (
|
|||||||
}).toString()
|
}).toString()
|
||||||
)
|
)
|
||||||
|
|
||||||
export { composeTrashboxURL }
|
const processTrashbox = (data: TrashboxResponse): Trashbox[] =>
|
||||||
|
data
|
||||||
|
|
||||||
|
export { composeTrashboxURL, processTrashbox }
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { LatLng } from 'leaflet'
|
import { LatLng } from 'leaflet'
|
||||||
|
|
||||||
import { useFetch } from '../'
|
import { useFetch } from '../'
|
||||||
import { composeTrashboxURL } from '../../api/trashbox'
|
import { composeTrashboxURL, processTrashbox } from '../../api/trashbox'
|
||||||
import { isTrashboxResponse } from '../../api/trashbox/types'
|
import { isTrashboxResponse } from '../../api/trashbox/types'
|
||||||
|
|
||||||
const useTrashboxes = (position: LatLng) => (
|
const useTrashboxes = (position: LatLng) => (
|
||||||
@ -10,7 +10,7 @@ const useTrashboxes = (position: LatLng) => (
|
|||||||
'GET',
|
'GET',
|
||||||
true,
|
true,
|
||||||
isTrashboxResponse,
|
isTrashboxResponse,
|
||||||
(data) => data,
|
processTrashbox,
|
||||||
[]
|
[]
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user