# extendify/3.0.5/src/Launch/api/axios.js

Extendify, version 3.0.5. 34 lines.

- Page: https://pluginprobe.com/plugins/extendify/3.0.5/code/src/Launch/api/axios.js
- Raw: https://pluginprobe.com/plugins/extendify/3.0.5/raw/src/Launch/api/axios.js
- Modified: 2026-02-18T22:27:14+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/extendify/3.0.5/code/src/Launch/api/axios.js#L10-L20`.

```javascript
import axios from 'axios';

const Axios = axios.create({
	baseURL: window.extSharedData.root,
	headers: {
		'X-WP-Nonce': window.extSharedData.nonce,
		'X-Requested-With': 'XMLHttpRequest',
		'X-Extendify': true,
	},
});

Axios.interceptors.response.use(
	(response) => findResponse(response),
	(error) => handleErrors(error),
);

const findResponse = (response) => {
	return Object.hasOwn(response, 'data') ? response.data : response;
};

const handleErrors = (error) => {
	if (!error.response) {
		return;
	}
	console.error(error.response);
	// if 4XX, return the error object
	if (error.response.status >= 400 && error.response.status < 500) {
		return Promise.reject(error.response);
	}
	return Promise.reject(findResponse(error.response));
};

export { Axios };

```
