Skip to content
Snippets Groups Projects
Commit 9ddc36a2 authored by fakihap's avatar fakihap
Browse files

fix: reset pagination on filter changes

parent 334b373f
Branches
Tags
No related merge requests found
......@@ -20,12 +20,15 @@ searchtext &&
searchtext.addEventListener("keyup",
function() {
searchFilters.title = searchtext.value;
searchFilters.page = 1; // making sure the page resets to one everytime we make a new search
resetPagination();
fetchRecipe();
}
)
// pagination keyup event
// refresh recipe search/fetch
// use of "var" is a bad practice
var fetchRecipe =
......@@ -133,7 +136,8 @@ diffFilters.forEach((e) => {
} else {
searchFilters.diff = "";
}
resetPagination();
fetchRecipe();
})
})
......@@ -156,11 +160,14 @@ tagFilters.forEach((e) => {
searchFilters.tag = "";
}
resetPagination();
fetchRecipe();
})
})
const resetPagination = () => {
searchFilters.page = 1; // making sure the page resets to one everytime we make a new search
}
// init refresh on first page open
fetchRecipe();
\ No newline at end of file
......@@ -37,9 +37,10 @@
border: none;
outline: none;
padding: 0 .2rem;
text-align: center;
border-radius: 30%;
text-align: center;
font-size: 10px;
font-weight: 200;
letter-spacing: 1px;
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment