Mock Back-end
Overview
We use axios-mock-adapter
for demo purpose, it intercepts
axios
requests and redirects to mocked handlers.
For more info on the library: https://github.com/ctimmerm/axios-mock-adapter.
How switching to the Real REST API
Remove mock initialization in src/index.js
:
-import { mockAxios, setupAxios } from "./_metronic";
+import { setupAxios } from "./_metronic";
import "./index.css";
/**
* Website public url.
*
* @see https://facebook.github.io/create-react-app/docs/using-the-public-folder
*/
const { PUBLIC_URL } = process.env;
-/**
- * Mock API, use return `mock` variable to add new mocks.
- *
- * @see https://github.com/ctimmerm/axios-mock-adapter
- */
-/* const mock = */mockAxios(axios);
-
/**
* Inject metronic interceptors for axios.