From 96a75a5df8814482e004d8cc1b6dfa04442b6197 Mon Sep 17 00:00:00 2001 From: Florian Feichtinger Date: Wed, 19 Oct 2016 00:24:29 +0200 Subject: [PATCH] Fixing routing error in server_auth example route index where an error got rendered as success page --- examples/server_auth/routes/index.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/examples/server_auth/routes/index.js b/examples/server_auth/routes/index.js index 70e9dfe..9cf0922 100644 --- a/examples/server_auth/routes/index.js +++ b/examples/server_auth/routes/index.js @@ -37,8 +37,7 @@ router.get('/', function(req, res) { if (typeof authCode !== 'undefined') { podio.getAccessToken(authCode, redirectURL, function (err) { - // we are ready to make API calls - res.render('success'); + res.render('error', { description: 'Error:' + err.status + " / " + err.message }); }); } else if (typeof errorCode !== 'undefined') { // an error occured @@ -51,13 +50,13 @@ router.get('/', function(req, res) { }); router.get('/user', function(req, res) { - + podio.isAuthenticated() .then(function() { return podio.request('get', '/user/status'); }) .then(function(responseData) { - res.render('user', { profile: responseData.profile }); + res.render('user', { profile: responseData.profile }); }) .catch(function(err) { res.send(401);