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.
 
 

51 lines
1.4 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)
{
return new Promise(function(resolve, reject)
{
if(request.session && request.session.user)
{
utils.getPostData(request).then(function (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).then(function(html)
{
resolve(html);
}).catch(function(err)
{
console.log(err);
reject(err);
})
}
});
}
};