Adding a tour package using Axios and Vuex
This section will build a functionality to add a new tour package to an existing tour list using Axios and Vuex.
Let's update services.js
of the store/tour
folder:
export async function postTourPackageAxios(tourPackage) { return await api.post("TourPackages", tourPackage); }
In the preceding code, we add a new service that creates new tourPackage
in the backend.
Next, we update types.js
of the store/tour
folder:
export const ADD_TOUR_PACKAGE = "ADD_TOUR_PACKAGE";
The code update adds a new action type for adding a tour package.
Now, update actions.js
in store/tour
using the following code:
import { getTourListsAxios, deleteTourListAxios, postTourListAxios, deleteTourPackageAxios, postTourPackageAxios, } from "@/store/tour/services";
We import the service postTourPackageAxios
first, as you can see in the preceding code. Now we can use imported...