Johnsoct
7/25/2019 - 2:43 PM

apiHelper Function (try/catch)

export const getClientByIdAPIHelper = async (payload, component) => {
  // payload: id
  try {
    const data = (await apiEndpoints.getClientById(payload)).data
    component.$store.commit('STORE_CLIENT', data)
  }
  catch (error) {
    component.$Progress.fail()
    component.$root.$emit('hideLoading')
    console.error(error)
    component.$Toastr.error('We had an issue fetching the client\'s information', 'Request error')
  }
}