Skip to content

Commit

Permalink
feat: Remove node-fetch dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
sebbo2002 committed Nov 17, 2023
1 parent 82e70bc commit 4d6911f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 134 deletions.
131 changes: 2 additions & 129 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"url": "https://github.com/sebbo2002/vestaboard/issues"
},
"dependencies": {
"grapheme-splitter": "^1.0.4",
"node-fetch": "^3.3.0"
"grapheme-splitter": "^1.0.4"
},
"description": "Just another client for the Vestaboard APIs.",
"devDependencies": {
Expand Down
5 changes: 2 additions & 3 deletions src/tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,15 @@ export async function request<T> (

let response: RequestFetchResponse | null = null;
for (let i = 0; i < 10; i++) {
response = await (options.fetch || (await import('node-fetch')).default)(url, init);
response = await (options.fetch || fetch)(url, init);
if(response.ok) {
break;
}

await new Promise(resolve => setTimeout(resolve, 1000));
}

/* c8 ignore next */
if(!response?.ok) {
if(!response.ok) {
throw new Error('HTTP Request failed');
}

Expand Down

0 comments on commit 4d6911f

Please sign in to comment.