fix(server/flash): Api to match documentation

This fixes duplication issues and normalize our use with everyone else
This commit is contained in:
Berkeley Martinez
2018-01-12 14:16:33 -08:00
parent 0cd21f930f
commit 4a911931d0
10 changed files with 88 additions and 86 deletions

View File

@ -103,14 +103,15 @@ export default function commit(app) {
pledge => {
if (pledge) {
debug('found previous pledge');
req.flash('info', {
msg: dedent`
req.flash(
'info',
dedent`
Looks like you already have a pledge to ${pledge.displayName}.
Clicking "Commit" here will replace your old commitment. If you
do change your commitment, please remember to cancel your
previous recurring donation directly with ${pledge.displayName}.
`
});
);
}
res.render(
'commit/',
@ -165,14 +166,15 @@ export default function commit(app) {
})
.subscribe(
({ displayName, goal, amount }) => {
req.flash('success', {
msg: dedent`
req.flash(
'success',
dedent`
Congratulations, you have committed to giving
${displayName} $${amount} each month until you have completed
your ${goal}. Please remember to cancel your pledge directly
with ${displayName} once you finish.
`
});
);
res.redirect('/' + user.username);
},
next
@ -229,7 +231,7 @@ export default function commit(app) {
there's no pledge to stop.
`;
}
req.flash('info', { msg });
req.flash('info', msg);
return res.redirect(`/${user.username}`);
},
next