X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=skyquake%2Fplugins%2Faccounts%2Fapi%2Faccounts.js;h=cf0e4048daae5d8612f5d8f4991e78d4692de0f4;hb=3d39b18290b9cb3e10c1a80d91ac4819e7c58474;hp=215032b1f77e79676b6f3dc1e126b1b76f82d533;hpb=9c013ddf2d997053c1c8d8bd732275a932ff6b0a;p=osm%2FUI.git diff --git a/skyquake/plugins/accounts/api/accounts.js b/skyquake/plugins/accounts/api/accounts.js index 215032b1f..cf0e4048d 100644 --- a/skyquake/plugins/accounts/api/accounts.js +++ b/skyquake/plugins/accounts/api/accounts.js @@ -42,7 +42,9 @@ Accounts.get = function(req) { type: req.params.type }) }); - }) + }, function(reason) { + reject(reason); + }) } else { getAll(req, resolve, reject); } @@ -66,6 +68,8 @@ Accounts.get = function(req) { statusCode: 200, data: ReturnData }); + }, function(reason) { + reject(reason); }) } } @@ -89,7 +93,7 @@ function getAccount(req) { _.extend( requestHeaders, id ? constants.HTTP_HEADERS.accept.data : constants.HTTP_HEADERS.accept.collection, { - 'Authorization': req.get('Authorization') + 'Authorization': req.session && req.session.authorization } ); @@ -156,7 +160,7 @@ function updateAccount(req) { _.extend(requestHeaders, constants.HTTP_HEADERS.accept.data, constants.HTTP_HEADERS.content_type.data, { - 'Authorization': req.get('Authorization') + 'Authorization': req.session && req.session.authorization }); request({ url: url, @@ -190,7 +194,7 @@ function deleteAccount(req) { _.extend(requestHeaders, constants.HTTP_HEADERS.accept.data, constants.HTTP_HEADERS.content_type.data, { - 'Authorization': req.get('Authorization') + 'Authorization': req.session && req.session.authorization }); request({ url: url, @@ -234,7 +238,7 @@ function refreshAccountConnectionStatus (req) { var headers = _.extend({}, constants.HTTP_HEADERS.accept.data, constants.HTTP_HEADERS.content_type.data, { - 'Authorization': req.get('Authorization') + 'Authorization': req.session && req.session.authorization } ); return new Promise(function(resolve, reject) {