mirror of
https://github.com/strapi/strapi.git
synced 2025-09-26 08:52:26 +00:00
Wrap axiosInstance inside a wrapper to contain the warnings
This commit is contained in:
parent
4a211a50d0
commit
68fee16bd2
@ -1,10 +1,6 @@
|
||||
import axios from 'axios';
|
||||
import { auth } from '@strapi/helper-plugin';
|
||||
|
||||
console.log(
|
||||
'Deprecation warning: Usage of "axiosInstance" utility is deprecated and will be removed in the next major release. Instead, use the useFetchClient() hook, which is exported from the helper-plugin: { useFetchClient } from "@strapi/helper-plugin"'
|
||||
);
|
||||
|
||||
const instance = axios.create({
|
||||
baseURL: process.env.STRAPI_ADMIN_BACKEND_URL,
|
||||
});
|
||||
@ -37,4 +33,20 @@ instance.interceptors.response.use(
|
||||
}
|
||||
);
|
||||
|
||||
export default instance;
|
||||
const wrapper = {};
|
||||
|
||||
['request', 'get', 'head', 'delete', 'options', 'post', 'put', 'patch', 'getUri'].forEach(
|
||||
(methodName) => {
|
||||
wrapper[methodName] = (...args) => {
|
||||
console.log(
|
||||
'Deprecation warning: Usage of "axiosInstance" utility is deprecated and will be removed in the next major release. Instead, use the useFetchClient() hook, which is exported from the helper-plugin: { useFetchClient } from "@strapi/helper-plugin"'
|
||||
);
|
||||
|
||||
return instance[methodName](...args);
|
||||
};
|
||||
|
||||
return wrapper;
|
||||
}
|
||||
);
|
||||
|
||||
export default wrapper;
|
||||
|
@ -3,10 +3,6 @@ import { auth } from '@strapi/helper-plugin';
|
||||
// TODO: remember to pass also the pluginId when you use the new get, post, put, delete methods from fetchClient
|
||||
import pluginId from '../pluginId';
|
||||
|
||||
console.log(
|
||||
'Deprecation warning: Usage of "axiosInstance" utility is deprecated and will be removed in the next major release. Instead, use the useFetchClient() hook, which is exported from the helper-plugin: { useFetchClient } from "@strapi/helper-plugin"'
|
||||
);
|
||||
|
||||
const instance = axios.create({
|
||||
baseURL: `${process.env.STRAPI_ADMIN_BACKEND_URL}/${pluginId}`,
|
||||
});
|
||||
@ -39,4 +35,20 @@ instance.interceptors.response.use(
|
||||
}
|
||||
);
|
||||
|
||||
export default instance;
|
||||
const wrapper = {};
|
||||
|
||||
['request', 'get', 'head', 'delete', 'options', 'post', 'put', 'patch', 'getUri'].forEach(
|
||||
(methodName) => {
|
||||
wrapper[methodName] = (...args) => {
|
||||
console.log(
|
||||
'Deprecation warning: Usage of "axiosInstance" utility is deprecated and will be removed in the next major release. Instead, use the useFetchClient() hook, which is exported from the helper-plugin: { useFetchClient } from "@strapi/helper-plugin"'
|
||||
);
|
||||
|
||||
return instance[methodName](...args);
|
||||
};
|
||||
|
||||
return wrapper;
|
||||
}
|
||||
);
|
||||
|
||||
export default wrapper;
|
||||
|
@ -1,10 +1,6 @@
|
||||
import axios from 'axios';
|
||||
import { auth } from '@strapi/helper-plugin';
|
||||
|
||||
console.log(
|
||||
'Deprecation warning: Usage of "axiosInstance" utility is deprecated and will be removed in the next major release. Instead, use the useFetchClient() hook, which is exported from the helper-plugin: { useFetchClient } from "@strapi/helper-plugin"'
|
||||
);
|
||||
|
||||
const instance = axios.create({
|
||||
baseURL: process.env.STRAPI_ADMIN_BACKEND_URL,
|
||||
});
|
||||
@ -37,4 +33,20 @@ instance.interceptors.response.use(
|
||||
}
|
||||
);
|
||||
|
||||
export default instance;
|
||||
const wrapper = {};
|
||||
|
||||
['request', 'get', 'head', 'delete', 'options', 'post', 'put', 'patch', 'getUri'].forEach(
|
||||
(methodName) => {
|
||||
wrapper[methodName] = (...args) => {
|
||||
console.log(
|
||||
'Deprecation warning: Usage of "axiosInstance" utility is deprecated and will be removed in the next major release. Instead, use the useFetchClient() hook, which is exported from the helper-plugin: { useFetchClient } from "@strapi/helper-plugin"'
|
||||
);
|
||||
|
||||
return instance[methodName](...args);
|
||||
};
|
||||
|
||||
return wrapper;
|
||||
}
|
||||
);
|
||||
|
||||
export default wrapper;
|
||||
|
@ -1,10 +1,6 @@
|
||||
import axios from 'axios';
|
||||
import { auth } from '@strapi/helper-plugin';
|
||||
|
||||
console.log(
|
||||
'Deprecation warning: Usage of "axiosInstance" utility is deprecated and will be removed in the next major release. Instead, use the useFetchClient() hook, which is exported from the helper-plugin: { useFetchClient } from "@strapi/helper-plugin"'
|
||||
);
|
||||
|
||||
const instance = axios.create({
|
||||
baseURL: process.env.STRAPI_ADMIN_BACKEND_URL,
|
||||
});
|
||||
|
@ -5,10 +5,6 @@
|
||||
import axios from 'axios';
|
||||
import { auth } from '@strapi/helper-plugin';
|
||||
|
||||
console.log(
|
||||
'Deprecation warning: Usage of "axiosInstance" utility is deprecated and will be removed in the next major release. Instead, use the useFetchClient() hook, which is exported from the helper-plugin: { useFetchClient } from "@strapi/helper-plugin"'
|
||||
);
|
||||
|
||||
const instance = axios.create({
|
||||
baseURL: process.env.STRAPI_ADMIN_BACKEND_URL,
|
||||
});
|
||||
@ -41,4 +37,20 @@ instance.interceptors.response.use(
|
||||
}
|
||||
);
|
||||
|
||||
export default instance;
|
||||
const wrapper = {};
|
||||
|
||||
['request', 'get', 'head', 'delete', 'options', 'post', 'put', 'patch', 'getUri'].forEach(
|
||||
(methodName) => {
|
||||
wrapper[methodName] = (...args) => {
|
||||
console.log(
|
||||
'Deprecation warning: Usage of "axiosInstance" utility is deprecated and will be removed in the next major release. Instead, use the useFetchClient() hook, which is exported from the helper-plugin: { useFetchClient } from "@strapi/helper-plugin"'
|
||||
);
|
||||
|
||||
return instance[methodName](...args);
|
||||
};
|
||||
|
||||
return wrapper;
|
||||
}
|
||||
);
|
||||
|
||||
export default wrapper;
|
||||
|
@ -5,10 +5,6 @@
|
||||
import axios from 'axios';
|
||||
import { auth } from '@strapi/helper-plugin';
|
||||
|
||||
console.log(
|
||||
'Deprecation warning: Usage of "axiosInstance" utility is deprecated and will be removed in the next major release. Instead, use the useFetchClient() hook, which is exported from the helper-plugin: { useFetchClient } from "@strapi/helper-plugin"'
|
||||
);
|
||||
|
||||
const instance = axios.create({
|
||||
baseURL: process.env.STRAPI_ADMIN_BACKEND_URL,
|
||||
});
|
||||
@ -41,4 +37,20 @@ instance.interceptors.response.use(
|
||||
}
|
||||
);
|
||||
|
||||
export default instance;
|
||||
const wrapper = {};
|
||||
|
||||
['request', 'get', 'head', 'delete', 'options', 'post', 'put', 'patch', 'getUri'].forEach(
|
||||
(methodName) => {
|
||||
wrapper[methodName] = (...args) => {
|
||||
console.log(
|
||||
'Deprecation warning: Usage of "axiosInstance" utility is deprecated and will be removed in the next major release. Instead, use the useFetchClient() hook, which is exported from the helper-plugin: { useFetchClient } from "@strapi/helper-plugin"'
|
||||
);
|
||||
|
||||
return instance[methodName](...args);
|
||||
};
|
||||
|
||||
return wrapper;
|
||||
}
|
||||
);
|
||||
|
||||
export default wrapper;
|
||||
|
@ -1,10 +1,6 @@
|
||||
import axios from 'axios';
|
||||
import { auth } from '@strapi/helper-plugin';
|
||||
|
||||
console.log(
|
||||
'Deprecation warning: Usage of "axiosInstance" utility is deprecated and will be removed in the next major release. Instead, use the useFetchClient() hook, which is exported from the helper-plugin: { useFetchClient } from "@strapi/helper-plugin"'
|
||||
);
|
||||
|
||||
const instance = axios.create({
|
||||
baseURL: process.env.STRAPI_ADMIN_BACKEND_URL,
|
||||
});
|
||||
@ -37,4 +33,20 @@ instance.interceptors.response.use(
|
||||
}
|
||||
);
|
||||
|
||||
export default instance;
|
||||
const wrapper = {};
|
||||
|
||||
['request', 'get', 'head', 'delete', 'options', 'post', 'put', 'patch', 'getUri'].forEach(
|
||||
(methodName) => {
|
||||
wrapper[methodName] = (...args) => {
|
||||
console.log(
|
||||
'Deprecation warning: Usage of "axiosInstance" utility is deprecated and will be removed in the next major release. Instead, use the useFetchClient() hook, which is exported from the helper-plugin: { useFetchClient } from "@strapi/helper-plugin"'
|
||||
);
|
||||
|
||||
return instance[methodName](...args);
|
||||
};
|
||||
|
||||
return wrapper;
|
||||
}
|
||||
);
|
||||
|
||||
export default wrapper;
|
||||
|
@ -1,10 +1,6 @@
|
||||
import axios from 'axios';
|
||||
import { auth } from '@strapi/helper-plugin';
|
||||
|
||||
console.log(
|
||||
'Deprecation warning: Usage of "axiosInstance" utility is deprecated and will be removed in the next major release. Instead, use the useFetchClient() hook, which is exported from the helper-plugin: { useFetchClient } from "@strapi/helper-plugin"'
|
||||
);
|
||||
|
||||
const instance = axios.create({
|
||||
baseURL: process.env.STRAPI_ADMIN_BACKEND_URL,
|
||||
});
|
||||
@ -37,4 +33,20 @@ instance.interceptors.response.use(
|
||||
}
|
||||
);
|
||||
|
||||
export default instance;
|
||||
const wrapper = {};
|
||||
|
||||
['request', 'get', 'head', 'delete', 'options', 'post', 'put', 'patch', 'getUri'].forEach(
|
||||
(methodName) => {
|
||||
wrapper[methodName] = (...args) => {
|
||||
console.log(
|
||||
'Deprecation warning: Usage of "axiosInstance" utility is deprecated and will be removed in the next major release. Instead, use the useFetchClient() hook, which is exported from the helper-plugin: { useFetchClient } from "@strapi/helper-plugin"'
|
||||
);
|
||||
|
||||
return instance[methodName](...args);
|
||||
};
|
||||
|
||||
return wrapper;
|
||||
}
|
||||
);
|
||||
|
||||
export default wrapper;
|
||||
|
Loading…
x
Reference in New Issue
Block a user