|
@ -154,17 +154,15 @@ module.exports= |
|
|
* @param templateContext json object used as the template context |
|
|
* @param templateContext json object used as the template context |
|
|
* @returns {Promise} renders the template used for this page |
|
|
* @returns {Promise} renders the template used for this page |
|
|
*/ |
|
|
*/ |
|
|
main: function(postData, templateContext) |
|
|
|
|
|
|
|
|
main: function(templateContext) |
|
|
{ |
|
|
{ |
|
|
return new Promise(function(resolve, reject) |
|
|
return new Promise(function(resolve, reject) |
|
|
{ |
|
|
{ |
|
|
Promise.all([includes.fetchTemplate(TEMPLATE_FILE), |
|
|
Promise.all([includes.fetchTemplate(TEMPLATE_FILE), |
|
|
addUserPostData(postData), |
|
|
|
|
|
removeUserPost(postData), |
|
|
|
|
|
editUserPost(postData, templateContext), |
|
|
|
|
|
getUserInformation(templateContext)]).then(function(template) |
|
|
getUserInformation(templateContext)]).then(function(template) |
|
|
{ |
|
|
{ |
|
|
resolve(template[0]); |
|
|
|
|
|
|
|
|
templateContext.adminPage = template[0]; |
|
|
|
|
|
resolve(); |
|
|
}).catch(function(error) |
|
|
}).catch(function(error) |
|
|
{ |
|
|
{ |
|
|
console.log("error in users.js"); |
|
|
console.log("error in users.js"); |
|
@ -173,7 +171,7 @@ module.exports= |
|
|
}); |
|
|
}); |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
processPostData: function(postData, templateContext) |
|
|
|
|
|
|
|
|
processPostData: function(templateContext, postData) |
|
|
{ |
|
|
{ |
|
|
return new Promise(function(resolve, reject) |
|
|
return new Promise(function(resolve, reject) |
|
|
{ |
|
|
{ |
|
@ -183,7 +181,8 @@ module.exports= |
|
|
editUserPost(postData, templateContext), |
|
|
editUserPost(postData, templateContext), |
|
|
getUserInformation(templateContext)]).then(function(template) |
|
|
getUserInformation(templateContext)]).then(function(template) |
|
|
{ |
|
|
{ |
|
|
resolve(template[0]); |
|
|
|
|
|
|
|
|
templateContext.adminPage = template[0]; |
|
|
|
|
|
resolve(); |
|
|
}).catch(function(error) |
|
|
}).catch(function(error) |
|
|
{ |
|
|
{ |
|
|
console.log("error in users.js"); |
|
|
console.log("error in users.js"); |
|
|