PluginProbe
Extendify / 0.10.2
Extendify v0.10.2
3.2.1 3.2.0 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.6 3.0.5 3.0.4 trunk 0.1.0 0.10.0 0.10.1 0.10.2 0.11.0 0.11.1 0.2.0 0.3.0 0.3.1 0.4.0 0.5.0 0.6.0 All 127 releases
extendify / src / Assist / api / axios.js

axios.js in Extendify 0.10.2, at src/Assist/api/axios.js

31 lines 825 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import axios from 'axios'
2
3 const Axios = axios.create({
4 baseURL: window.extAssistData.root,
5 headers: {
6 'X-WP-Nonce': window.extAssistData.nonce,
7 'X-Requested-With': 'XMLHttpRequest',
8 'X-Extendify-Assist': true,
9 'X-Extendify': true,
10 },
11 })
12 Axios.interceptors.request.use(
13 (request) => checkDevMode(request),
14 (error) => error,
15 )
16 Axios.interceptors.response.use((response) =>
17 Object.prototype.hasOwnProperty.call(response, 'data')
18 ? response.data
19 : response,
20 )
21
22 const checkDevMode = (request) => {
23 request.headers['X-Extendify-Assist-Dev-Mode'] =
24 window.location.search.indexOf('DEVMODE') > -1
25 request.headers['X-Extendify-Assist-Local-Mode'] =
26 window.location.search.indexOf('LOCALMODE') > -1
27 return request
28 }
29
30 export { Axios }
31