Skip to content

Commit

Permalink
Merge pull request #419 from ertush/hotfix
Browse files Browse the repository at this point in the history
Updated facilities next, previous and page navigation buttons
  • Loading branch information
ertush authored Jul 10, 2024
2 parents 8f1b2c3 + a2ae1da commit 5abc14d
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions pages/facilities/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ function FacilityHome (props){
const userCtx = useContext(UserContext);
const groupID = userCtx?.groups[0]?.id


// const qf = props?.query?.qf ?? null

if (filters && typeof filters === "object")
Expand Down Expand Up @@ -153,36 +154,44 @@ function FacilityHome (props){

function handleNext() {

const params = Object.fromEntries(pageParams.entries())

router.push({
pathname:'/facilities',
query: {
next: Buffer.from(`${props?.next}`).toString('base64') //default: page_size=30
// next: `${props?.next}&page_size=20`
next: Buffer.from(`${props?.next}`).toString('base64'), //default: page_size=30
...params
}
})
}

function handlePrevious() {

const params = Object.fromEntries(pageParams.entries())

router.push({
pathname:'/facilities',
query: {
previous: Buffer.from(`${props?.previous}`).toString('base64') //default: page_size=30
previous: Buffer.from(`${props?.previous}`).toString('base64'),
...params
//default: page_size=30
// previous: `${props?.previous}&page_size=20`
}
})
}

function handlePageLoad(e) {

const params = Object.fromEntries(pageParams.entries())

const page = e.target.innerHTML

console.log({page})

router.push({
pathname:'/facilities',
query: {
page
page,
...params
// previous: `${props?.previous}&page_size=20`
}
})
Expand Down

0 comments on commit 5abc14d

Please sign in to comment.