Skip to content

Commit

Permalink
fix: ignore empty filter value
Browse files Browse the repository at this point in the history
  • Loading branch information
jzhangdev committed May 30, 2024
1 parent 177e575 commit 6a75d47
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "fix: ignore empty filter value",
"packageName": "@rightcapital/verdaccio-package-diff",
"email": "[email protected]",
"dependentChangeType": "patch"
}
17 changes: 10 additions & 7 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,17 @@
const filter = params.get('filter');

if (name && from && to) {
fetch(
`/-/npm/package-diff/data?name=${name}&from=${from}&to=${to}&filter=${filter}`,
{
headers: {
Authorization: typeof token === 'string' && `Bearer ${token}`,
},
const query = new URLSearchParams({ name: name, from: from, to: to });

if (filter) {
query.append('filter', filter);
}

fetch(`/-/npm/package-diff/data?${query.toString()}`, {
headers: {
Authorization: typeof token === 'string' && `Bearer ${token}`,
},
).then(async (response) => {
}).then(async (response) => {
if (response.status === 401) {
const fragment = document.createDocumentFragment();
const linkElement = document.createElement('a');
Expand Down

0 comments on commit 6a75d47

Please sign in to comment.