diff --git a/examples/README.md b/examples/README.md index f7b5a96d..89c305f5 100644 --- a/examples/README.md +++ b/examples/README.md @@ -5,7 +5,7 @@ To run the examples in your development environment: 1. Clone this repo 2. Run `npm install` and `npm run build` 3. Start the development server with `node server.js`. -4. Point your browser to +4. Point your browser to # Dropbox TypeScript SDK Examples diff --git a/examples/javascript/PKCE-backend/code_flow_example.js b/examples/javascript/PKCE-backend/code_flow_example.js index af4e6760..36a7ef21 100644 --- a/examples/javascript/PKCE-backend/code_flow_example.js +++ b/examples/javascript/PKCE-backend/code_flow_example.js @@ -11,7 +11,7 @@ const port = 3000; const config = { fetch, - clientId: [clientId], + clientId: '42zjexze6mfpf7x', }; const { Dropbox } = require('dropbox'); // eslint-disable-line import/no-unresolved @@ -45,8 +45,9 @@ app.get('/auth', (req, res) => { // eslint-disable-line no-unused-vars }); }) .catch((error) => { - console.log(error); + console.error(error); }); + res.end(); }); app.listen(port); diff --git a/examples/javascript/auth/index.html b/examples/javascript/auth/index.html index a563b324..7545aaf4 100644 --- a/examples/javascript/auth/index.html +++ b/examples/javascript/auth/index.html @@ -80,7 +80,7 @@

renderItems(response.result.entries); }) .catch(function(error) { - console.error(error); + console.error(error.error || error); }); } else { showPageSection('pre-auth-section'); diff --git a/examples/javascript/basic/index.html b/examples/javascript/basic/index.html index de616815..961e9025 100644 --- a/examples/javascript/basic/index.html +++ b/examples/javascript/basic/index.html @@ -56,7 +56,7 @@

displayFiles(response.result.entries); }) .catch(function(error) { - console.error(error); + console.error(error.error || error); }); } diff --git a/examples/javascript/download/index.html b/examples/javascript/download/index.html index 61fc0775..9c3aa307 100644 --- a/examples/javascript/download/index.html +++ b/examples/javascript/download/index.html @@ -50,16 +50,16 @@

var dbx = new Dropbox.Dropbox({ accessToken: ACCESS_TOKEN }); dbx.sharingGetSharedLinkFile({url: SHARED_LINK}) .then(function(data) { - var downloadUrl = URL.createObjectURL(data.fileBlob); + var downloadUrl = URL.createObjectURL(data.result.fileBlob); var downloadButton = document.createElement('a'); downloadButton.setAttribute('href', downloadUrl); - downloadButton.setAttribute('download', data.name); + downloadButton.setAttribute('download', data.result.name); downloadButton.setAttribute('class', 'button'); - downloadButton.innerText = 'Download: ' + data.name; + downloadButton.innerText = 'Download: ' + data.result.name; document.getElementById('results').appendChild(downloadButton); }) .catch(function(error) { - console.error(error); + console.error(error.error || error); }); return false; } diff --git a/examples/javascript/node/download.js b/examples/javascript/node/download.js index 83f3dda6..ea61527f 100644 --- a/examples/javascript/node/download.js +++ b/examples/javascript/node/download.js @@ -17,9 +17,9 @@ prompt.get({ const dbx = new Dropbox({ accessToken: result.accessToken }); dbx.sharingGetSharedLinkFile({ url: result.sharedLink }) .then((data) => { - fs.writeFile(data.name, data.fileBinary, 'binary', (err) => { + fs.writeFile(data.result.name, data.result.fileBinary, 'binary', (err) => { if (err) { throw err; } - console.log(`File: ${data.name} saved.`); + console.log(`File: ${data.result.name} saved.`); }); }) .catch((err) => { diff --git a/examples/javascript/pkce-browser/index.html b/examples/javascript/pkce-browser/index.html index da6818cc..7f7c87f8 100644 --- a/examples/javascript/pkce-browser/index.html +++ b/examples/javascript/pkce-browser/index.html @@ -106,7 +106,7 @@

renderItems(response.result.entries); }) .catch((error) => { - console.error(error) + console.error(error.error || error); }); } else { showPageSection('pre-auth-section'); diff --git a/examples/javascript/simple-backend/code_flow_example.js b/examples/javascript/simple-backend/code_flow_example.js index 88f3ad7c..d9f76fe2 100644 --- a/examples/javascript/simple-backend/code_flow_example.js +++ b/examples/javascript/simple-backend/code_flow_example.js @@ -11,8 +11,8 @@ const port = 3000; const config = { fetch, - clientId: 'jg8wc1hfkvel6ql', - clientSecret: 'f0i5w4e6mlbbme5', + clientId: 'APP_KEY_HERE', + clientSecret: 'APP_SECRET_HERE', }; const { Dropbox } = require('dropbox'); // eslint-disable-line import/no-unresolved @@ -45,8 +45,9 @@ app.get('/auth', (req, res) => { // eslint-disable-line no-unused-vars }); }) .catch((error) => { - console.log(error); + console.error(error); }); + res.end(); }); app.listen(port); diff --git a/examples/javascript/team-as-user/index.html b/examples/javascript/team-as-user/index.html index b0e66698..21f3afcc 100644 --- a/examples/javascript/team-as-user/index.html +++ b/examples/javascript/team-as-user/index.html @@ -28,11 +28,11 @@

-

This example shows how to use the Dropbox class and the Dropbox.actAsUser() [docs] method, to retreive a Dropbox class that is acting as a specific user on the team.

+

This example shows how to use the Dropbox class and the selectUser [docs] parameter, to retreive a Dropbox class that is acting as a specific user on the team.

- +
@@ -46,15 +46,15 @@