es6 update for examples

This commit is contained in:
Todd Treece 2016-05-27 13:34:07 -04:00
parent e5fce06c9a
commit 913d96e88c
2 changed files with 11 additions and 11 deletions

View file

@ -1,8 +1,8 @@
var NPR = require('../index'), const NPR = require('../index'),
npr = NPR(); npr = new NPR();
// paste in your token here // paste in your token here or use env var
var token = process.env.ACCESS_TOKEN || 'access_token_from_step_1'; const token = process.env.ACCESS_TOKEN || 'access_token_from_step_1';
npr.one.init(token) npr.one.init(token)
.then(function() { .then(function() {

View file

@ -1,8 +1,8 @@
var NPR = require('../index'), const NPR = require('../index'),
npr = NPR(); npr = new NPR();
var client_id = process.env.CLIENT_ID || 'your_oauth_client_id', const client_id = process.env.CLIENT_ID || 'your_oauth_client_id',
client_secret = process.env.CLIENT_SECRET || 'your_oauth_client_secret'; client_secret = process.env.CLIENT_SECRET || 'your_oauth_client_secret';
npr.one.init() npr.one.init()
.then(function() { .then(function() {
@ -20,8 +20,8 @@ npr.one.init()
return new Promise(function(resolve, reject) { return new Promise(function(resolve, reject) {
console.log('Please visit the following URL:'); console.log('Please visit the following URL:');
console.log(res.verification_uri + '\n'); console.log(`${res.verification_uri}\n`);
console.log('Enter code: ' + res.user_code + '\n'); console.log(`Enter code: ${res.user_code}\n`);
console.log('Press the Spacebar when complete.'); console.log('Press the Spacebar when complete.');
process.stdin.setRawMode(true); process.stdin.setRawMode(true);
@ -44,7 +44,7 @@ npr.one.init()
}); });
}) })
.then(function(res) { .then(function(res) {
console.log('ACCESS TOKEN: ' + res.access_token); console.log(`ACCESS TOKEN: ${res.access_token}`);
process.exit(); process.exit();
}) })
.catch(function(err) { .catch(function(err) {