in lib/bzapi.js [46:92]
export function fetchIssueCount({ priority, product, bug_severity } = {}) {
const params = {
product,
priority,
bug_severity,
count_only: true,
limit: 0,
};
/* istanbul ignore next */
if (params.bug_priority && params.bug_severity) {
throw new Error('Query only severity or priority independently');
}
if (bug_severity) {
delete params.priority;
}
if (priority) {
delete params.bug_severity;
}
if (product === 'Toolkit') {
params.component = 'Add-ons Manager';
}
const apiURL = `${baseAPIURL}?${queryString.stringify({
...params,
...openBugParams,
})}`;
const webParams = { ...params, ...openBugParams };
delete webParams.count_only;
const webURL = `${baseWEBURL}?${queryString.stringify(webParams)}`;
return serverSWR(
apiURL,
async () => {
const res = await fetch(apiURL, {
headers: { 'Content-Type': 'application/json' },
});
const json = await res.json();
return { count: json.bug_count, url: webURL };
},
{
hashKey: true,
},
);
}