Skip to content

Commit

Permalink
Use fetch from auth (#929)
Browse files Browse the repository at this point in the history
* Use fetch from auth

* remove unused

* remove fetch stub
  • Loading branch information
rogebrd authored Apr 4, 2022
1 parent 1305318 commit 71f0a42
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dropbox",
"version": "10.27.0",
"version": "10.27.1",
"registry": "npm",
"description": "The Dropbox JavaScript SDK is a lightweight, promise based interface to the Dropbox v2 API that works in both nodejs and browser environments.",
"main": "cjs/index.js",
Expand Down
10 changes: 1 addition & 9 deletions src/dropbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ import DropboxAuth from './auth.js';
import { baseApiUrl, httpHeaderSafeJson } from './utils.js';
import { parseDownloadResponse, parseResponse } from './response.js';

let fetch;

const b64 = typeof btoa === 'undefined'
? (str) => Buffer.from(str).toString('base64')
: btoa;
Expand Down Expand Up @@ -53,19 +51,13 @@ export default class Dropbox {
constructor(options) {
options = options || {};

if (typeof window !== 'undefined') {
fetch = window.fetch.bind(window);
} else {
fetch = require('node-fetch'); // eslint-disable-line global-require
}

if (options.auth) {
this.auth = options.auth;
} else {
this.auth = new DropboxAuth(options);
}

this.fetch = options.fetch || fetch;
this.fetch = options.fetch || this.auth.fetch;
this.selectUser = options.selectUser;
this.selectAdmin = options.selectAdmin;
this.pathRoot = options.pathRoot;
Expand Down

0 comments on commit 71f0a42

Please sign in to comment.