Browse Source

Updated downloads page to work with routes.

pull/61/head
jrtechs 5 years ago
parent
commit
e30ecec170
2 changed files with 14 additions and 3 deletions
  1. +4
    -3
      admin/adminDownloads.js
  2. +10
    -0
      routes/admin/downloads.js

+ 4
- 3
admin/adminDownloads.js View File

@ -116,7 +116,8 @@ module.exports=
Promise.all([includes.fetchTemplate(TEMPLATE_FILE),
displayDownloads(templateContext)]).then(function(template)
{
resolve(template[0]);
templateContext.adminPage = template[0];
resolve();
}).catch(function(error)
{
console.log("error in add downloads.js");
@ -125,7 +126,7 @@ module.exports=
});
},
processPostData: function(postData, templateContext)
processPostData: function(postData)
{
return new Promise(function(resolve, reject)
{
@ -135,7 +136,7 @@ module.exports=
resolve();
}).catch(function(error)
{
console.log(error);
console.log("Error in admin downloads");
reject(error);
})
})

+ 10
- 0
routes/admin/downloads.js View File

@ -1,8 +1,18 @@
const routes = require('express').Router();
const utils = require('../../utils/utils.js');
routes.get('/', (request, result) =>
{
utils.constructAdminPage(request, result, require("../../admin/adminDownloads").main)
});
routes.post('/', (request, result) =>
{
utils.adminPostRoute(request ,require("../../admin/adminDownloads").processPostData).then(function()
{
result.redirect('/admin/downloads');
})
});
module.exports = routes;

Loading…
Cancel
Save