From 3e0e775af98eecbcafce5082051ef2bcdee18487 Mon Sep 17 00:00:00 2001 From: Hippo Date: Wed, 5 Jan 2022 18:56:13 +0530 Subject: [PATCH] Save reminder count properly Earlier, it wasn't being checked at all so everything was being set to the default of 10. --- server/index.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/server/index.js b/server/index.js index 6d10ed0..408d43e 100644 --- a/server/index.js +++ b/server/index.js @@ -144,6 +144,14 @@ router.post('/pledge', async (req, res) => { } let phone = req.body.phone + + let retryTimes + try { + retryTimes = req.body['reminder-count'] + } catch (err) { + errors.push('Invalid retry count. Please choose a positive number!') + } + let newsletter = req.body.newsletter == 'yes' ? true : false let overseas = req.body.overseas == 'yes' ? true : false let messages = req.body.messages @@ -162,6 +170,7 @@ router.post('/pledge', async (req, res) => { pledge.set('anonymous', anonymous) pledge.set('email', email) pledge.set('phone', phone) + pledge.set('retry_times', retryTimes) pledge.set('get_newsletter', newsletter) pledge.set('other_message', messages)