Fix Photos page current page when changing filter
This commit is contained in:
@@ -55,7 +55,7 @@
|
|||||||
$: currentCountry = countries.find((country: any) => country.slug === filterCountry)
|
$: currentCountry = countries.find((country: any) => country.slug === filterCountry)
|
||||||
|
|
||||||
// Pages related informations
|
// Pages related informations
|
||||||
let currentPage: number = 1
|
let currentPage = 1
|
||||||
let ended: boolean
|
let ended: boolean
|
||||||
let currentPhotosAmount: number
|
let currentPhotosAmount: number
|
||||||
$: currentPhotosAmount = photos.length
|
$: currentPhotosAmount = photos.length
|
||||||
@@ -119,17 +119,20 @@
|
|||||||
// Country select
|
// Country select
|
||||||
const handleCountryChange = ({ detail: value }) => {
|
const handleCountryChange = ({ detail: value }) => {
|
||||||
filterCountry = value === defaultCountry ? defaultCountry : value
|
filterCountry = value === defaultCountry ? defaultCountry : value
|
||||||
|
currentPage = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sort select
|
// Sort select
|
||||||
const handleSortChange = ({ detail: value }) => {
|
const handleSortChange = ({ detail: value }) => {
|
||||||
filterSort = value === defaultSort ? defaultSort : value
|
filterSort = value === defaultSort ? defaultSort : value
|
||||||
|
currentPage = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset filters
|
// Reset filters
|
||||||
const resetFiltered = () => {
|
const resetFiltered = () => {
|
||||||
filterCountry = defaultCountry
|
filterCountry = defaultCountry
|
||||||
filterSort = defaultSort
|
filterSort = defaultSort
|
||||||
|
currentPage = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user