HTTP requests using Axios

Axios (https://github.com/axios/axios) is a Promise-based HTTP client. It is a powerful and flexible library with a very straightforward API. It is used to fetch data from the JHipster application's server-side REST endpoints from Redux actions. The resulting Promise is resolved by the Redux Promise Middleware to provide data to the reducer.

The following code shows a Redux action with an asynchronous payload:

export const getEnv = () => ({
type: ACTION_TYPES.FETCH_ENV,
payload: axios.get('management/env')
});

Axios is used to fetch the payload and return the promise that will be resolved by our Redux middleware.

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

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