Changing rebuild route so that it redirects back with a flash message rather than pinning to the 'view' page
This commit is contained in:
parent
c44dc8ce95
commit
4feee6f257
1 changed files with 8 additions and 3 deletions
|
@ -15,7 +15,12 @@ module.exports = function(app) {
|
|||
var start = 0;
|
||||
}
|
||||
Post.getPosts(count, start, function(err, posts){
|
||||
res.render('admin-post-list', {posts, user: req.user});
|
||||
res.render('admin-post-list', {
|
||||
successNotice: req.flash('successNotice'),
|
||||
failureNotice: req.flash('failureNotice'),
|
||||
posts: posts,
|
||||
user: req.user
|
||||
});
|
||||
});
|
||||
}
|
||||
);
|
||||
|
@ -156,12 +161,12 @@ module.exports = function(app) {
|
|||
post.buildPost(function (err) {
|
||||
if (!err) {
|
||||
req.flash('successNotice', 'Post rebuilt successfully.');
|
||||
res.redirect('/admin/post/view/'+req.params.uuid);
|
||||
res.redirect(req.header('Referer') || '/admin');
|
||||
}
|
||||
else {
|
||||
console.log(err);
|
||||
req.flash('failureNotice', 'Post regeneration failed, check logs.');
|
||||
res.redirect('/admin/post/view/'+req.params.uuid);
|
||||
res.redirect(req.header('Referer') || '/admin');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue