diff options
Diffstat (limited to 'src/geddit.js')
-rw-r--r-- | src/geddit.js | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/geddit.js b/src/geddit.js index 3231b5e..aee7703 100644 --- a/src/geddit.js +++ b/src/geddit.js | |||
@@ -18,11 +18,11 @@ class Geddit { | |||
18 | include_over_18: true, | 18 | include_over_18: true, |
19 | }; | 19 | }; |
20 | 20 | ||
21 | subreddit = subreddit ? `/r/${subreddit}` : ""; | 21 | const subredditStr = subreddit ? `/r/${subreddit}` : ""; |
22 | 22 | ||
23 | return await fetch( | 23 | return await fetch( |
24 | `${ | 24 | `${ |
25 | this.host + subreddit | 25 | this.host + subredditStr |
26 | }/${sort}.json?${new URLSearchParams(Object.assign(params, options))}`, | 26 | }/${sort}.json?${new URLSearchParams(Object.assign(params, options))}`, |
27 | ) | 27 | ) |
28 | .then((res) => res.json()) | 28 | .then((res) => res.json()) |
@@ -300,7 +300,7 @@ class Geddit { | |||
300 | 300 | ||
301 | async searchAll(query, subreddit = null, options = {}) { | 301 | async searchAll(query, subreddit = null, options = {}) { |
302 | options.q = query; | 302 | options.q = query; |
303 | subreddit = subreddit ? `/r/${subreddit}` : ""; | 303 | const subredditStr = subreddit ? `/r/${subreddit}` : ""; |
304 | 304 | ||
305 | const params = { | 305 | const params = { |
306 | limit: 25, | 306 | limit: 25, |
@@ -310,7 +310,7 @@ class Geddit { | |||
310 | 310 | ||
311 | return await fetch( | 311 | return await fetch( |
312 | `${ | 312 | `${ |
313 | this.host + subreddit | 313 | this.host + subredditStr |
314 | }/search.json?${new URLSearchParams(Object.assign(params, options))}`, | 314 | }/search.json?${new URLSearchParams(Object.assign(params, options))}`, |
315 | ) | 315 | ) |
316 | .then((res) => res.json()) | 316 | .then((res) => res.json()) |