Updating a tour package using Axios and Vuex
We are in the last section of this chapter, and this section is about updating a tour package using a PUT HTTP request and Vuex. We are going to create another form for editing a tour package. So let's start.
The first task is to update services.js
in the store/tour
directory:
export async function putTourPackageAxios(tourList) { Â Â return await api.put(`TourPackages/${tourList.id}`, Â Â tourList); }
We are adding a new service that sends a PUT request to our backend server.
Next, we update types.js
of the store/tour
folder again:
export const UPDATE_TOUR_PACKAGE = "UPDATE_TOUR_PACKAGE";
The preceding code is a new action type for updating a tour package.
Next, we also update actions.js
in the store/tour
folder:
import { getTourListsAxios, deleteTourListAxios, Â Â postTourListAxios, deleteTourPackageAxios, Â Â postTourPackageAxios, putTourPackageAxios, } from "...