Skip to content

Commit

Permalink
Remove Local Booking Cache
Browse files Browse the repository at this point in the history
  • Loading branch information
vincent-tsugranes committed Oct 20, 2021
1 parent 94873fe commit c732037
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/components/BookingList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export default class BookingList extends Vue {
}
mounted () {
console.log('Mounted Booking List Component')
// console.log('Mounted Booking List Component')
this.$store.dispatch('ENSURE_LOADED_BOOKINGS').then(() => {
this.bookings = this.$store.state.bookings
})
Expand Down
4 changes: 3 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ Vue.use(VueSidebarMenu)
store.dispatch('ENSURE_LOADED_FLIGHTS')
store.dispatch('ENSURE_LOADED_CREWMEMBERS')
store.dispatch('ENSURE_LOADED_AIRPORTS')
store.dispatch('ENSURE_LOADED_BOOKINGS')

// don't pre-cache bookings since we pull every time
// store.dispatch('ENSURE_LOADED_BOOKINGS')

new Vue({
router,
Expand Down
6 changes: 4 additions & 2 deletions src/services/BookingService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ export async function UpsertBooking (booking: Booking) {
}

if (response.body !== null) {
const data = JSON.parse(response.json.toString()) as Response
return data.json
const responseJson = JSON.stringify(response.body)
console.log('Successfully Booked: ' + response.status + ' - ' + booking.passenger_name)
// const data = JSON.parse(response.json.toString()) as Response
// return data.json
}
}
7 changes: 6 additions & 1 deletion src/store/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default new Vuex.Store({
},
ADD_BOOKING (state, booking) {
UpsertBooking(booking)
state.bookings.push(booking)
// state.bookings.push(booking)
}
},
actions: {
Expand Down Expand Up @@ -93,6 +93,7 @@ export default new Vuex.Store({
return dispatch('FETCH_BOOKINGS')
},
FETCH_BOOKINGS: ({ commit, state }) => {
/*
if (state.bookings.length === 0) {
// console.log('GETTING AIRPORTS')
Expand All @@ -103,6 +104,10 @@ export default new Vuex.Store({
// console.log('RETURNING EXISTING AIRPORTS')
return state.bookings
}
*/
return GetAllBookings().then(response => {
commit('SET_BOOKINGS', response)
})
}
},
modules: {},
Expand Down

0 comments on commit c732037

Please sign in to comment.