projects
/
osm
/
UI.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge "NOTICKET: Refactor with sessions. Now holds auth on server" into projects
[osm/UI.git]
/
skyquake
/
plugins
/
accounts
/
api
/
accounts.js
diff --git
a/skyquake/plugins/accounts/api/accounts.js
b/skyquake/plugins/accounts/api/accounts.js
index
215032b
..
cf0e404
100644
(file)
--- 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
})
});
type: req.params.type
})
});
- })
+ }, function(reason) {
+ reject(reason);
+ })
} else {
getAll(req, resolve, reject);
}
} else {
getAll(req, resolve, reject);
}
@@
-66,6
+68,8
@@
Accounts.get = function(req) {
statusCode: 200,
data: ReturnData
});
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, {
_.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, {
_.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,
});
request({
url: url,
@@
-190,7
+194,7
@@
function deleteAccount(req) {
_.extend(requestHeaders,
constants.HTTP_HEADERS.accept.data,
constants.HTTP_HEADERS.content_type.data, {
_.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,
});
request({
url: url,
@@
-234,7
+238,7
@@
function refreshAccountConnectionStatus (req) {
var headers = _.extend({},
constants.HTTP_HEADERS.accept.data,
constants.HTTP_HEADERS.content_type.data, {
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) {
}
);
return new Promise(function(resolve, reject) {