Personal blog written from scratch using Node.js, Bootstrap, and MySQL. https://jrtechs.net
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

57 lines
1.6 KiB

/**
* Renders the admin page contents
*/
//file IO
const utils = require('../utils/utils.js');
module.exports=
{
/**
* Method calls the admin widgets it correct order
*
* @param request
* @return {*|Promise}
*/
main: function(request, clientAddress, templateContext)
{
return new Promise(function(resolve, reject)
{
//if logged in
if(request.session && request.session.user)
{
templateContext.loggedIn = true;
utils.getPostData(request).then(function (postData)
{
resolve();
// console.log(postData);
// Promise.all([require("./posts/newPost.js").main(postData),
// require("./category/addCategory.js").main(postData),
// require("./posts/editPost.js").main(postData),
// require("./downloads/manageDownloads.js").main(postData)])
// .then(function(content)
// {
// resolve(content.join(''));
// }).catch(function(error)
// {
// reject(error);
// });
});
}
else
{
require("./login/login.js").main(request, clientAddress, templateContext).then(function()
{
resolve();
}).catch(function(err)
{
console.log(err);
reject(err);
})
}
});
}
};