mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-16 06:02:41 +00:00
fix pagination not applying sort
This commit is contained in:
@@ -269,9 +269,7 @@ const VaultPage = (props)=>{
|
|||||||
sortState === optionValue ? `active` : ''
|
sortState === optionValue ? `active` : ''
|
||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
<button onClick={() => {
|
<button onClick={() => loadPage(1, false, optionValue, oppositeDir)}>
|
||||||
loadPage(1, false, optionValue, oppositeDir)
|
|
||||||
}}>
|
|
||||||
{optionTitle}
|
{optionTitle}
|
||||||
</button>
|
</button>
|
||||||
{sortState === optionValue && (
|
{sortState === optionValue && (
|
||||||
@@ -319,7 +317,7 @@ const VaultPage = (props)=>{
|
|||||||
className={`pageNumber ${
|
className={`pageNumber ${
|
||||||
pageState === startPage + index ? 'currentPage' : ''
|
pageState === startPage + index ? 'currentPage' : ''
|
||||||
}`}
|
}`}
|
||||||
onClick={()=>loadPage(startPage + index)}
|
onClick={()=>loadPage(startPage + index, false, sortState, dirState)}
|
||||||
>
|
>
|
||||||
{startPage + index}
|
{startPage + index}
|
||||||
</a>
|
</a>
|
||||||
@@ -329,7 +327,7 @@ const VaultPage = (props)=>{
|
|||||||
<div className='paginationControls'>
|
<div className='paginationControls'>
|
||||||
<button
|
<button
|
||||||
className='previousPage'
|
className='previousPage'
|
||||||
onClick={()=>loadPage(pageState - 1)}
|
onClick={()=>loadPage(pageState - 1, false, sortState, dirState)}
|
||||||
disabled={pageState === startPage}
|
disabled={pageState === startPage}
|
||||||
>
|
>
|
||||||
<i className='fa-solid fa-chevron-left'></i>
|
<i className='fa-solid fa-chevron-left'></i>
|
||||||
@@ -338,7 +336,7 @@ const VaultPage = (props)=>{
|
|||||||
{startPage > 1 && (
|
{startPage > 1 && (
|
||||||
<a
|
<a
|
||||||
className='pageNumber firstPage'
|
className='pageNumber firstPage'
|
||||||
onClick={()=>loadPage()}
|
onClick={()=>loadPage(1, false, sortState, dirState)}
|
||||||
>
|
>
|
||||||
1 ...
|
1 ...
|
||||||
</a>
|
</a>
|
||||||
@@ -347,7 +345,7 @@ const VaultPage = (props)=>{
|
|||||||
{endPage < totalPages && (
|
{endPage < totalPages && (
|
||||||
<a
|
<a
|
||||||
className='pageNumber lastPage'
|
className='pageNumber lastPage'
|
||||||
onClick={()=>loadPage(totalPages)}
|
onClick={()=>loadPage(totalPages, false, sortState, dirState)}
|
||||||
>
|
>
|
||||||
... {totalPages}
|
... {totalPages}
|
||||||
</a>
|
</a>
|
||||||
@@ -355,7 +353,7 @@ const VaultPage = (props)=>{
|
|||||||
</ol>
|
</ol>
|
||||||
<button
|
<button
|
||||||
className='nextPage'
|
className='nextPage'
|
||||||
onClick={()=>loadPage(pageState + 1)}
|
onClick={()=>loadPage(pageState + 1, false, sortState, dirState)}
|
||||||
disabled={pageState === totalPages}
|
disabled={pageState === totalPages}
|
||||||
>
|
>
|
||||||
<i className='fa-solid fa-chevron-right'></i>
|
<i className='fa-solid fa-chevron-right'></i>
|
||||||
|
|||||||
@@ -62,8 +62,8 @@ const findBrews = async (req, res)=>{
|
|||||||
};
|
};
|
||||||
|
|
||||||
await HomebrewModel.find(combinedQuery, projection)
|
await HomebrewModel.find(combinedQuery, projection)
|
||||||
.skip(skip)
|
|
||||||
.sort(sortConditions(sort, dir))
|
.sort(sortConditions(sort, dir))
|
||||||
|
.skip(skip)
|
||||||
.limit(count)
|
.limit(count)
|
||||||
.maxTimeMS(5000)
|
.maxTimeMS(5000)
|
||||||
.exec()
|
.exec()
|
||||||
|
|||||||
Reference in New Issue
Block a user