Fix bug where lack of user confirmation causes some bugs to occur

This commit is contained in:
Eric Schultz 2019-05-20 13:23:32 -05:00
parent 4b272a1489
commit d4c5780444

View file

@ -6,8 +6,11 @@ module.exports = function(npo_id) {
var eventsPath = '/nonprofits/' + npo_id + '/events/name_and_id' var eventsPath = '/nonprofits/' + npo_id + '/events/name_and_id'
request.get(campaignsPath).end(function(err, resp){ request.get(campaignsPath).end(function(err, resp){
var dataResponse = []
if (!err) {
resp.body.unshift(false) resp.body.unshift(false)
let campaign_id_names = resp.body.map((i) => { dataResponse = resp.body.map((i) => {
if (i.isChildCampaign) if (i.isChildCampaign)
{ {
return {id: i.id, name: i.name + " - " + i.creator} return {id: i.id, name: i.name + " - " + i.creator}
@ -17,10 +20,17 @@ module.exports = function(npo_id) {
return {id: i.id, name: i.name} return {id: i.id, name: i.name}
} }
}) })
appl.def('campaigns.data', campaign_id_names) }
appl.def('campaigns.data', dataResponse)
}) })
request.get(eventsPath).end(function(err, resp){ request.get(eventsPath).end(function(err, resp){
var dataResponse = []
if(!err) {
resp.body.unshift(false) resp.body.unshift(false)
appl.def('events.data', resp.body) dataResponse = resp.body
}
appl.def('events.data', dataResponse)
}) })
} }