Skip to content

Commit 894a59c

Browse files
committed
Handle undefined cache duration
1 parent f6992c5 commit 894a59c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/api.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export default class Api {
6666
headers?: Array<Pair<string, string>>,
6767
body?: string
6868
) {
69-
if (cacheDurationSeconds === 0) {
69+
if (!cacheDurationSeconds) {
7070
return await this.get(method, path, params, headers, body);
7171
}
7272

@@ -86,7 +86,7 @@ export default class Api {
8686

8787
const result = await this.get(method, path, params, headers, body);
8888

89-
this.cache.put(rawUrl, result, Math.max(cacheDurationSeconds * 1000, 1));
89+
this.cache.put(rawUrl, result, cacheDurationSeconds * 1000);
9090

9191
return result;
9292
}

0 commit comments

Comments
 (0)