Skip to content

Commit

Permalink
SMA-107: user's coordinates are passed when calling getNearbyEvents
Browse files Browse the repository at this point in the history
  • Loading branch information
ivamach committed May 3, 2024
1 parent bed61ec commit dd7ce84
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions frontend/sportsmatch-app/src/pages/Index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { ApiError, EventDTO, EventsControllerService } from '../generated/api'
import useModal from '../hooks/UseModal'
import Modal from '../components/Modal'
import JoinEventComponent from '../components/JoinEventComponent'
import useLocation from '../hooks/UseLocation'

export default function MainPage() {
const [searchQuery, setSearchQuery] = useState<string>('')
Expand All @@ -21,6 +22,8 @@ export default function MainPage() {
const [page, setPage] = useState<number>(0)
const size = 3

const userCoords = useLocation().coords

// handle sports name selected from sportButtoncomponent
const handleSportSelectionChange = (selectedButtonSports: string[]) => {
setSelectedSports(selectedButtonSports)
Expand All @@ -45,8 +48,8 @@ export default function MainPage() {
try {
const response = await EventsControllerService.getNearbyEvents(
selectedSports,
0,
0,
userCoords.longitude || undefined,
userCoords.latitude || undefined,
searchQuery,
page,
size,
Expand All @@ -71,7 +74,7 @@ export default function MainPage() {
}
// call the method
fetchData()
}, [selectedSports, page, searchQuery])
}, [selectedSports, page, searchQuery, userCoords.latitude, userCoords.longitude])

Check failure on line 77 in frontend/sportsmatch-app/src/pages/Index.tsx

View workflow job for this annotation

GitHub Actions / test

Replace `selectedSports,·page,·searchQuery,·userCoords.latitude,·userCoords.longitude` with `⏎····selectedSports,⏎····page,⏎····searchQuery,⏎····userCoords.latitude,⏎····userCoords.longitude,⏎··`

// handle join event pop up after cliking on the event
const handleEventSelection = (e: EventDTO) => {
Expand Down

0 comments on commit dd7ce84

Please sign in to comment.