HTTP requests using Axios

Similar to our setup for React, Axios (https://github.com/axios/axios) is used to fetch data from the JHipster application's server-side REST endpoints from the Vue.js services. The resulting Promise is resolved by the service to provide data to the components.

The following shows a service using axios:

export default class UserManagementService {
public get(userId: number): Promise<any> {
return axios.get(`api/users/${userId}`);
}

public create(user): Promise<any> {
return axios.post('api/users', user);
}
...
}

The preceding service uses axios and returns a promise that can be resolved from the component.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.83.150