Set parameter only if necessary
parent
dae582eedc
commit
0cb3cdb534
|
@ -78,9 +78,9 @@ export default class ThreadSearchQuery implements IQuery {
|
||||||
if (this.onlyTitles) url.searchParams.set("c[title_only]", "1");
|
if (this.onlyTitles) url.searchParams.set("c[title_only]", "1");
|
||||||
|
|
||||||
// Add keywords
|
// Add keywords
|
||||||
const encodedKeywords = this.keywords ? encodeURIComponent(this.keywords) : "*";
|
const encodedKeywords = this.keywords ?? "*";
|
||||||
url.searchParams.set("q", encodedKeywords);
|
url.searchParams.set("q", encodedKeywords);
|
||||||
|
|
||||||
// Specify the scope of the search (only "threads/post")
|
// Specify the scope of the search (only "threads/post")
|
||||||
url.searchParams.set("t", "post");
|
url.searchParams.set("t", "post");
|
||||||
|
|
||||||
|
@ -99,11 +99,11 @@ export default class ThreadSearchQuery implements IQuery {
|
||||||
// The tags are first joined with a comma, then encoded to URI
|
// The tags are first joined with a comma, then encoded to URI
|
||||||
const includedTags = encodeURIComponent(this.includedTags.join(","));
|
const includedTags = encodeURIComponent(this.includedTags.join(","));
|
||||||
const excludedTags = encodeURIComponent(this.excludedTags.join(","));
|
const excludedTags = encodeURIComponent(this.excludedTags.join(","));
|
||||||
url.searchParams.set("c[tags]", includedTags);
|
if (includedTags) url.searchParams.set("c[tags]", includedTags);
|
||||||
url.searchParams.set("c[excludeTags]", excludedTags);
|
if (excludedTags) url.searchParams.set("c[excludeTags]", excludedTags);
|
||||||
|
|
||||||
// Set minimum reply number
|
// Set minimum reply number
|
||||||
url.searchParams.set("c[min_reply_count]", this.minimumReplies.toString());
|
if (this.minimumReplies > 0) url.searchParams.set("c[min_reply_count]", this.minimumReplies.toString());
|
||||||
|
|
||||||
// Add prefixes
|
// Add prefixes
|
||||||
const parser = new PrefixParser();
|
const parser = new PrefixParser();
|
||||||
|
|
Loading…
Reference in New Issue