var config = require('../user/config-user');

/*
 * Checks if a session exists in cache using the session token as an id and returns the session found
 *
 * @params {Object} mbaasApi object which allows access to cache
 * @params {String} sessionToken string that is used as an id for the specified session in cache.
 * @params {Function} cb function callback
 */
function checkSession(mbaasApi, sessionToken, cb) {
  var options = {
    "act": "load",
    "key": sessionToken
  };
  
  mbaasApi.cache(options, function(err, session){
    if(err){
      return cb(err);
    }
    return cb(err, JSON.parse(session));
  });
}

/*
 * Saves specified session in cache
 *
 * @params {Object} mbaasApi object which allows access to cache
 * @params {String} sessionToken string that is used as an id for the specified session in cache.
 * @params {Object} session object which holds all the session details
 * @params {Function} cb function callback
 */
function saveSession(mbaasApi, sessionToken, session, cb) {

  var options = {
    "act": "save",
    "key": sessionToken,
    "expire": config.sessionTokenExpiry,
    "value": JSON.stringify(session)
  };

  mbaasApi.cache(options, function(err) {
    return cb(err, session);
  });
}

module.exports = {
  checkSession: checkSession,
  saveSession: saveSession
};
@@ -475,18 +475,16 @@
 en%0A  %7D;%0A
-  
 %0A  mbaas
@@ -528,16 +528,17 @@
 ion)
+ 
 %7B%0A    if
 (err
@@ -533,21 +533,23 @@
 %7B%0A    if
+ 
 (err)
+ 
 %7B%0A      

fix build