In this part, we will create the <script> section of the single file component. Follow these steps to create it:
- Open the App.vue file in the src folder.
- Import the getHttp, postHttp, patchHttp, and deleteHTTP methods from the fetchHttp wrapper that we made in the 'Creating a wrapper for the Fetch API as an HTTP client' recipe:
import {
getHttp,
postHttp,
patchHttp,
deleteHttp,
} from './http/fetchApi';
- In the data property, we need to create three new properties to be used, response, userData, and userId:
data: () => ({
response: undefined,
userData: '',
userId: undefined,
}),
- In the methods property, we need to create four new methods, getAllUsers, createUser, updateUser, and deleteUser:
methods: {
async getAllUsers() {
},
async createUser() {
},
async updateUser() {
},
async deleteUser() {
},
},
- In the getAllUsers method, we will set the response data property as the result...