Skip to content
This repository was archived by the owner on Sep 2, 2025. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/api.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
const fetch = require('node-fetch')
const extend = require('tricks/object/extend')

// This is a hack for an instance whereby the node-fetch module is incorrectly being imported
const fetchFunction = typeof fetch === 'function' ? fetch : fetch.default
module.exports = class Hub {

constructor(opts) {
Expand Down Expand Up @@ -47,7 +49,7 @@ module.exports = class Hub {
}
}

const resp = await fetch(url, {...opts, headers})
const resp = await fetchFunction(url, {...opts, headers})

if (convertToJSON) {
return resp.json()
Expand Down