export async function fetchByFlightId()

in src/frontend/src/store/catalog/actions.js [116:138]


export async function fetchByFlightId({ commit }, { flightId }) {
  console.group('store/booking/actions/fetchByFlightId')

  try {
    commit('SET_LOADER', true)
    const {
      // @ts-ignore
      data: { getFlight: flightData }
    } = await API.graphql(graphqlOperation(getFlight, { id: flightId }))

    const flight = new Flight(flightData)

    console.log(flight)
    commit('SET_LOADER', false)
    console.groupEnd()
    return flight
  } catch (error) {
    console.error(error)
    commit('SET_LOADER', false)
    console.groupEnd()
    throw new Error(error)
  }
}