feat(reviews): add reviews route
allows seeing all reviews with optional filters. works sans JS as well closes https://github.com/zyachel/libremdb/issues/25 closes https://codeberg.org/zyachel/libremdb/issues/19
This commit is contained in:
@ -81,18 +81,13 @@ export const AppError = class extends Error {
|
||||
}
|
||||
};
|
||||
|
||||
export const cleanQueryStr = (
|
||||
entries: [string, string][],
|
||||
filterable = ['q', 's', 'exact', 'ttype']
|
||||
) => {
|
||||
let queryStr = '';
|
||||
export const cleanQueryStr = (record: Record<string, string>, filterable: string[]) => {
|
||||
const urlSearchParams = new URLSearchParams();
|
||||
|
||||
entries.forEach(([key, val], i) => {
|
||||
if (!val || !filterable.includes(key)) return;
|
||||
queryStr += `${i > 0 ? '&' : ''}${key}=${val.trim()}`;
|
||||
filterable.forEach(key => {
|
||||
if (record[key]) urlSearchParams.append(key, record[key].trim());
|
||||
});
|
||||
|
||||
return queryStr;
|
||||
return urlSearchParams.toString();
|
||||
};
|
||||
|
||||
export const getResTitleTypeHeading = (
|
||||
|
Reference in New Issue
Block a user