Skip to content

Commit

Permalink
use maps API when cancelling select position on mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
wbazant committed Jul 19, 2024
1 parent 4acddef commit d77484b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/components/mobile/LocationPositionNav.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { useParams } from 'react-router-dom'
import styled from 'styled-components/macro'

import { updatePosition } from '../../redux/locationSlice'
import { setView } from '../../redux/mapSlice'
import { useAppHistory } from '../../utils/useAppHistory'
import { theme } from '../ui/GlobalStyle'
import IconButton from '../ui/IconButton'
Expand All @@ -20,11 +19,12 @@ const LocationPositionNav = () => {
const dispatch = useDispatch()
const { locationId } = useParams()
const center = useSelector((state) => state.map.view?.center)
const googleMap = useSelector((state) => state.map.googleMap)
const storedPosition = useSelector((state) => state.location.position)

const handleCancel = () => {
if (storedPosition) {
dispatch(setView({ center: storedPosition }))
googleMap?.setCenter(storedPosition)
}
history.push(`/locations/${locationId}/edit/details`)
}
Expand Down

0 comments on commit d77484b

Please sign in to comment.