> For the complete documentation index, see [llms.txt](https://docs.cremawork.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cremawork.com/decelopment/axios-config.md).

# Axios Config

We are using the Axios to make an API call. Here is the global Axios configuration. You can find it on this path `src/@crema/services/auth/jwt-auth/index.js`

```typescript
import axios from '@crema/services/axios';

const jwtAxios = axios?.create({
  baseURL: 'https://cremaapi.pythonanywhere.com/api/', //YOUR_API_URL HERE
  headers: {
    'Content-Type': 'application/json',
  },
});
jwtAxios.interceptors.response.use(
  (res) => res,
  (err) => {
    if (err.response && err.response.data.msg === 'Token is not valid') {
      console.log('Need to logout user');
      // store.dispatch({type: LOGOUT});
    }
    return Promise.reject(err);
  },
);
export const setAuthToken = (token) => {
  if (token) {
    jwtAxios.defaults.headers.common['Authorization'] = 'Bearer ' + token;
    localStorage.setItem('token', token);
  } else {
    delete jwtAxios.defaults.headers.common['Authorization'];
    localStorage.removeItem('token');
  }
};

export default jwtAxios;
```

We are using the mock APIs in our app, to get the fake data from the Crema fake DB. We are using [axios-mock-adapter](https://www.npmjs.com/package/axios-mock-adapter) to achieve this. Here is the configuration of it. you can find out this file here `src/@crema/mockapi/apis/MockConfig.js`

```javascript
import axios from '@crema/services/axios';

// eslint-disable-next-line @typescript-eslint/no-var-requires
const MockAdapter = require('axios-mock-adapter');

export default new MockAdapter(axios, {delayResponse: 200});
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.cremawork.com/decelopment/axios-config.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
