Axios API Calls
Mock API calls
Set default axios baseURL for call API
Open .env
file and edit REACT_APP_API_URL.
.env
You can configure the same for next.js as well.
Axios has been configured in the folder src/utils/axios.ts
Example 1: With baseUrl
src/utils/axios.ts
Example 2: Without baseUrl
You can set the entire URL in Axios request. Do not use common Axios instances src\utils\axios.ts
instead use directly Axios library.
src\utils\axios.ts
Last updated