Skip to content

Commit 71f0a42

Browse files
authored
Use fetch from auth (#929)
* Use fetch from auth * remove unused * remove fetch stub
1 parent 1305318 commit 71f0a42

File tree

2 files changed

+2
-10
lines changed

2 files changed

+2
-10
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dropbox",
3-
"version": "10.27.0",
3+
"version": "10.27.1",
44
"registry": "npm",
55
"description": "The Dropbox JavaScript SDK is a lightweight, promise based interface to the Dropbox v2 API that works in both nodejs and browser environments.",
66
"main": "cjs/index.js",

src/dropbox.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ import DropboxAuth from './auth.js';
1313
import { baseApiUrl, httpHeaderSafeJson } from './utils.js';
1414
import { parseDownloadResponse, parseResponse } from './response.js';
1515

16-
let fetch;
17-
1816
const b64 = typeof btoa === 'undefined'
1917
? (str) => Buffer.from(str).toString('base64')
2018
: btoa;
@@ -53,19 +51,13 @@ export default class Dropbox {
5351
constructor(options) {
5452
options = options || {};
5553

56-
if (typeof window !== 'undefined') {
57-
fetch = window.fetch.bind(window);
58-
} else {
59-
fetch = require('node-fetch'); // eslint-disable-line global-require
60-
}
61-
6254
if (options.auth) {
6355
this.auth = options.auth;
6456
} else {
6557
this.auth = new DropboxAuth(options);
6658
}
6759

68-
this.fetch = options.fetch || fetch;
60+
this.fetch = options.fetch || this.auth.fetch;
6961
this.selectUser = options.selectUser;
7062
this.selectAdmin = options.selectAdmin;
7163
this.pathRoot = options.pathRoot;

0 commit comments

Comments
 (0)