Commit 35855468 authored by Moises Sacal's avatar Moises Sacal
Browse files

fixes eresearch/rdm#999

parent 5a4b09b4
...@@ -70,7 +70,13 @@ var Controllers; ...@@ -70,7 +70,13 @@ var Controllers;
let info = {}; let info = {};
return WorkspaceService.workspaceAppFromUserId(userId, this.config.appName) return WorkspaceService.workspaceAppFromUserId(userId, this.config.appName)
.flatMap(response => { .flatMap(response => {
const user = response['info'] || null; let user = null;
if (!response) {
user = null;
}
else {
user = response['info'] || null;
}
if (user) { if (user) {
const userInfo = LabarchivesService.userInfo(this.config.key, user['id'], true); const userInfo = LabarchivesService.userInfo(this.config.key, user['id'], true);
return rxjs_1.Observable.fromPromise(userInfo); return rxjs_1.Observable.fromPromise(userInfo);
......
{ {
"name": "sails-hook-redbox-labarchives", "name": "sails-hook-redbox-labarchives",
"version": "1.0.0", "version": "1.0.1",
"description": "A Sails Hook for LabArchives", "description": "A Sails Hook for LabArchives",
"main": "index.js", "main": "index.js",
"sails": { "sails": {
......
...@@ -75,8 +75,7 @@ export module Controllers { ...@@ -75,8 +75,7 @@ export module Controllers {
sails.log.error(error); sails.log.error(error);
this.ajaxFail(req, res, errorMessage, {status: false, message: errorMessage}); this.ajaxFail(req, res, errorMessage, {status: false, message: errorMessage});
}); });
} } else {
else {
const message = 'Input username and password'; const message = 'Input username and password';
this.ajaxFail(req, res, message, {status: false, message: message}); this.ajaxFail(req, res, message, {status: false, message: message});
} }
...@@ -89,7 +88,12 @@ export module Controllers { ...@@ -89,7 +88,12 @@ export module Controllers {
let info = {}; let info = {};
return WorkspaceService.workspaceAppFromUserId(userId, this.config.appName) return WorkspaceService.workspaceAppFromUserId(userId, this.config.appName)
.flatMap(response => { .flatMap(response => {
const user = response['info'] || null; let user = null;
if (!response) {
user = null;
} else {
user = response['info'] || null;
}
if (user) { if (user) {
const userInfo = LabarchivesService.userInfo(this.config.key, user['id'], true); const userInfo = LabarchivesService.userInfo(this.config.key, user['id'], true);
return Observable.fromPromise(userInfo); return Observable.fromPromise(userInfo);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment