Fix Photos page current page when changing filter

This commit is contained in:
2021-11-17 21:49:39 +01:00
parent d37a88f1ae
commit 85ee5fc2b7

View File

@@ -55,7 +55,7 @@
$: currentCountry = countries.find((country: any) => country.slug === filterCountry)
// Pages related informations
let currentPage: number = 1
let currentPage = 1
let ended: boolean
let currentPhotosAmount: number
$: currentPhotosAmount = photos.length
@@ -119,17 +119,20 @@
// Country select
const handleCountryChange = ({ detail: value }) => {
filterCountry = value === defaultCountry ? defaultCountry : value
currentPage = 1
}
// Sort select
const handleSortChange = ({ detail: value }) => {
filterSort = value === defaultSort ? defaultSort : value
currentPage = 1
}
// Reset filters
const resetFiltered = () => {
filterCountry = defaultCountry
filterSort = defaultSort
currentPage = 1
}