Last active
March 9, 2017 16:55
-
-
Save ojengwa/543df924329c55aadfad16562bdbeff9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let unassigned = realtime.unassigned.child(attrs.body.order_id) | |
let assigned = realtime.assigned.child(attrs.body.order_id) | |
unassigned.ref.once('value', (data) => { | |
data = data.val() | |
data['status'] = 'assigned' | |
assigned.set(data, (error) => { | |
if (!error) { | |
let champion_ref = realtime.champions.child(attrs.body.champion_id + '/assigned/' + attrs.body.order_id) | |
champion_ref.set(data, (error) => { | |
if (!error){ unassigned.remove()} | |
}) | |
} | |
}) | |
}, (err) => { | |
console.log(err, '<= firebase error') | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment