Skip to content

Commit

Permalink
fix: url query filters
Browse files Browse the repository at this point in the history
  • Loading branch information
vatsalsinghkv committed Dec 3, 2024
1 parent 58e9cc6 commit de16fe2
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 18 deletions.
37 changes: 21 additions & 16 deletions src/containers/Issues.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,22 +47,27 @@ const Issues = () => {
return (
<div>
<div className='py-5 space-y-3'>
{data.items.map((issue) => (
<Issue
date={issue.created_at}
key={issue.html_url}
repoUrl={issue.repository_url}
title={issue.title}
url={issue.html_url}
comments={issue.comments}
>
{issue.labels.map((label) => (
<Label key={toId(label.name)} className='mr-1.5 mt-2'>
{label.name}
</Label>
))}
</Issue>
))}
{/* Filters out pull requests */}
{data.items.map((issue) =>
!issue.html_url.includes('/pull/') ? (
<Issue
date={issue.created_at}
key={issue.html_url}
repoUrl={issue.repository_url}
title={issue.title}
url={issue.html_url}
comments={issue.comments}
>
{issue.labels.map((label) => (
<Label key={toId(label.name)} className='mr-1.5 mt-2'>
{label.name}
</Label>
))}
</Issue>
) : (
<></>
)
)}
</div>
<Pagination
currentPage={page}
Expand Down
4 changes: 2 additions & 2 deletions src/lib/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {
DEFAULT_LABEL,
INITIAL_LABELS,
ISSUE_PER_PAGE,
ISSUE_URL,
Expand Down Expand Up @@ -156,7 +155,7 @@ export const composeUrl = (
order,
page,
per_page: ISSUE_PER_PAGE,
q: `${QUERIES}+${langQuery}${labelQuery}`,
q: `${QUERIES}${langQuery}${labelQuery}`,
sort,
};

Expand All @@ -170,5 +169,6 @@ export const composeUrl = (
// the API is not parsing the URL correctly :(
url.search = decodeURIComponent(url.search);

console.log({ url: url.toString() });
return url.toString();
};

0 comments on commit de16fe2

Please sign in to comment.