Created
October 31, 2018 07:49
-
-
Save mgmgpyaesonewin/76bcce3bea0d17cdb5a5d330098636c7 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
| delete_booking(code) { | |
| this.get_id_by_code(code, (id) => { | |
| this.$store.dispatch('delete_booking', id) | |
| .then(() => { | |
| this.$toasted.show('Deleted successfully'); | |
| this.status = false; | |
| }) | |
| .catch(() => this.$toasted.show('Something went wrong')); | |
| }); | |
| }, | |
| get_id_by_code(code, callback) { | |
| const database = firebase.database(); | |
| database.ref('booking') | |
| .orderByChild('booking_code') | |
| .equalTo(code) | |
| .on('value', (snapshot) => { | |
| const ids = Object.keys(snapshot.val()); | |
| callback(ids[0]); | |
| }); | |
| }, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment