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.

41 lines
1.1 KiB

  1. const utils = require('../utils/utils.js');
  2. var Promise = require('promise');
  3. module.exports=
  4. {
  5. /**
  6. * Method calls the admin widgets it correct order
  7. *
  8. * @param result
  9. * @param fileName
  10. * @param request
  11. * @return {*|Promise}
  12. */
  13. main: function(result, fileName, request)
  14. {
  15. result.write("<div class=\"w3-row\">");
  16. return new Promise(function(resolve, reject)
  17. {
  18. if(request.session && request.session.user)
  19. {
  20. utils.getPostData(request).then(function (postData)
  21. {
  22. return require("../admin/newPost.js").main(result, postData);
  23. }).then(function(postData)
  24. {
  25. return require("../admin/addCategory.js").main(result, postData);
  26. }).then(function()
  27. {
  28. result.write("</div>");
  29. resolve();
  30. });
  31. }
  32. else
  33. {
  34. //login page
  35. return require("../admin/login.js").main(result, request);
  36. }
  37. });
  38. }
  39. };