Improve redirect for failure editing accounts

main
sudoer777 2021-11-26 17:08:13 -07:00
parent 6c174f3e02
commit 7132273e9e
1 changed files with 3 additions and 1 deletions

View File

@ -214,7 +214,9 @@ router.post('/account', checkLoginStatus.user, async function(req, res, next) {
catch (err) { catch (err) {
console.error("ERROR: " + err.message); console.error("ERROR: " + err.message);
req.flash("error", "An error has occurred."); req.flash("error", "An error has occurred.");
res.redirect('/manage/account'); let URL = '/manage/account';
if(loggedInAccountIsAdmin && accountID) URL += `?account=${accountID}`;
res.redirect(URL);
} }
} }
}); });