To fetch the data in the MirageJS server, we will need to define some options in our axios instance. Now, in the following steps, we will configure the axios instance to work with the new routering system:
- In the src/http folder, open the baseFetch.js file.
- At the creator of the localApi instance of axios, we will need to add an options object, passing the baseURL property. This baseURL will be the current browser navigation URL:
const localApi = createAxios({
baseURL: `${document.location.protocol}//${document.location.host}`,
});