Skip to content

Commit

Permalink
fix: do not pass userId in query for non-user-filtered requests page
Browse files Browse the repository at this point in the history
  • Loading branch information
TheCatLady committed Mar 29, 2021
1 parent 2f92dba commit 64494c1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion server/routes/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ requestRoutes.get('/', async (req, res, next) => {
const skip = req.query.skip ? Number(req.query.skip) : 0;
const requestedBy = req.query.requestedBy
? Number(req.query.requestedBy)
: 0;
: null;

let statusFilter: MediaRequestStatus[];

Expand Down
20 changes: 15 additions & 5 deletions src/components/RequestList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,9 @@ const RequestList: React.FC = () => {
setCurrentFilter(e.target.value as Filter);
router.push({
pathname: router.pathname,
query: { userId: router.query.userId },
query: router.query.userId
? { userId: router.query.userId }
: {},
});
}}
value={currentFilter}
Expand Down Expand Up @@ -181,7 +183,9 @@ const RequestList: React.FC = () => {
setCurrentSort(e.target.value as Sort);
router.push({
pathname: router.pathname,
query: { userId: router.query.userId },
query: router.query.userId
? { userId: router.query.userId }
: {},
});
}}
value={currentSort}
Expand Down Expand Up @@ -258,7 +262,9 @@ const RequestList: React.FC = () => {
router
.push({
pathname: router.pathname,
query: { userId: router.query.userId },
query: router.query.userId
? { userId: router.query.userId }
: {},
})
.then(() => window.scrollTo(0, 0));
}}
Expand All @@ -283,7 +289,9 @@ const RequestList: React.FC = () => {
.push(
{
pathname: `${router.pathname}?page=${page - 1}`,
query: { userId: router.query.userId },
query: router.query.userId
? { userId: router.query.userId }
: {},
},
undefined,
{
Expand All @@ -302,7 +310,9 @@ const RequestList: React.FC = () => {
.push(
{
pathname: `${router.pathname}?page=${page + 1}`,
query: { userId: router.query.userId },
query: router.query.userId
? { userId: router.query.userId }
: {},
},
undefined,
{
Expand Down

0 comments on commit 64494c1

Please sign in to comment.