Last commit ?
This commit is contained in:
parent
75060a0997
commit
34a5f703ea
9 changed files with 61 additions and 26 deletions
|
|
@ -7,14 +7,20 @@ function getSession (req, callback) {
|
|||
url: 'http://127.0.0.1:3000/verify:token',
|
||||
body: 'sessionid='+req.headers.cookie.replace('SESSIONID=','')
|
||||
},function (error, response, body) {
|
||||
const bodyJson = JSON.parse(body);
|
||||
if (bodyJson && bodyJson.status && bodyJson.data) {
|
||||
if (bodyJson.status === 'ok') {
|
||||
return callback(bodyJson.data.token);
|
||||
} else {
|
||||
return callback(bodyJson.data.reason);
|
||||
console.log("body ; getSession auth private :",body);
|
||||
if(typeof body !== 'undefined'){
|
||||
const bodyJson = JSON.parse(body);
|
||||
if (bodyJson && bodyJson.status && bodyJson.data) {
|
||||
if (bodyJson.status === 'ok') {
|
||||
return callback(bodyJson.data.token);
|
||||
} else {
|
||||
return callback(bodyJson.data.reason);
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
return callback('Error');
|
||||
}
|
||||
});
|
||||
}
|
||||
return callback(undefined);
|
||||
|
|
|
|||
Reference in a new issue