forked from external-repos/pa11y-dashboard
Make the "new task" form functional
This commit is contained in:
15
route/new.js
15
route/new.js
@@ -4,7 +4,22 @@ module.exports = route;
|
||||
|
||||
// Route definition
|
||||
function route (app) {
|
||||
|
||||
app.express.get('/new', function (req, res) {
|
||||
res.render('new');
|
||||
});
|
||||
|
||||
app.express.post('/new', function (req, res) {
|
||||
var newTask = {
|
||||
url: req.body.url,
|
||||
standard: req.body.standard
|
||||
};
|
||||
app.webservice.tasks.create(newTask, function (err, task) {
|
||||
if (err) {
|
||||
return res.render('new', {error: err});
|
||||
}
|
||||
res.redirect('/' + task.id + '?added');
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user