diff --git a/packages/core/admin/admin/src/components/AuthenticatedApp/utils/api.js b/packages/core/admin/admin/src/components/AuthenticatedApp/utils/api.js index 2f03015bb4..81a90fa0a3 100644 --- a/packages/core/admin/admin/src/components/AuthenticatedApp/utils/api.js +++ b/packages/core/admin/admin/src/components/AuthenticatedApp/utils/api.js @@ -39,6 +39,9 @@ const fetchStrapiLatestRelease = async (toggleNotification) => { const fetchAppInfo = async () => { try { const { data, headers } = await axiosInstance.get('/admin/information'); + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function getClient' + ); if (!headers['content-type'].includes('application/json')) { throw new Error('Not found'); @@ -53,6 +56,9 @@ const fetchAppInfo = async () => { const fetchCurrentUserPermissions = async () => { try { const { data, headers } = await axiosInstance.get('/admin/users/me/permissions'); + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function getClient' + ); if (!headers['content-type'].includes('application/json')) { throw new Error('Not found'); @@ -71,6 +77,9 @@ const fetchUserRoles = async () => { data: { roles }, }, } = await axiosInstance.get('/admin/users/me'); + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function getClient' + ); return roles; } catch (err) { diff --git a/packages/core/admin/admin/src/content-manager/components/CollectionTypeFormWrapper/index.js b/packages/core/admin/admin/src/content-manager/components/CollectionTypeFormWrapper/index.js index 968007064f..3b4d853113 100644 --- a/packages/core/admin/admin/src/content-manager/components/CollectionTypeFormWrapper/index.js +++ b/packages/core/admin/admin/src/content-manager/components/CollectionTypeFormWrapper/index.js @@ -138,6 +138,9 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin } try { const { data } = await axiosInstance.get(requestURL, { cancelToken: source.token }); + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function getClient' + ); dispatch(getDataSucceeded(cleanReceivedData(cleanClonedData(data)))); } catch (err) { @@ -222,6 +225,9 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin } const { data } = await axiosInstance.delete( getRequestUrl(`collection-types/${slug}/${id}`) ); + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function deleteClient' + ); toggleNotification({ type: 'success', @@ -253,6 +259,9 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin } dispatch(setStatus('submit-pending')); const { data } = await axiosInstance.post(endPoint, body); + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function postClient' + ); trackUsageRef.current('didCreateEntry', trackerProperty); toggleNotification({ @@ -304,6 +313,9 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin } dispatch(setStatus('draft-relation-check-pending')); const numberOfDraftRelations = await axiosInstance.get(endPoint); + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function getClient' + ); trackUsageRef.current('didCheckDraftRelations'); dispatch(setStatus('resolved')); @@ -325,6 +337,9 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin } dispatch(setStatus('publish-pending')); const { data } = await axiosInstance.post(endPoint); + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function postClient' + ); trackUsageRef.current('didPublishEntry'); @@ -355,6 +370,9 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin } dispatch(setStatus('submit-pending')); const { data } = await axiosInstance.put(endPoint, body); + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function putClient' + ); trackUsageRef.current('didEditEntry', { trackerProperty }); toggleNotification({ @@ -391,6 +409,9 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin } trackUsageRef.current('willUnpublishEntry'); const { data } = await axiosInstance.post(endPoint); + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function postClient' + ); trackUsageRef.current('didUnpublishEntry'); toggleNotification({ diff --git a/packages/core/admin/admin/src/content-manager/components/DynamicTable/CellContent/RelationMultiple/index.js b/packages/core/admin/admin/src/content-manager/components/DynamicTable/CellContent/RelationMultiple/index.js index 0dcf472c80..4bc2e2956c 100644 --- a/packages/core/admin/admin/src/content-manager/components/DynamicTable/CellContent/RelationMultiple/index.js +++ b/packages/core/admin/admin/src/content-manager/components/DynamicTable/CellContent/RelationMultiple/index.js @@ -22,6 +22,9 @@ const fetchRelation = async (endPoint, notifyStatus) => { const { data: { results, pagination }, } = await axiosInstance.get(endPoint); + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function getClient' + ); notifyStatus(); diff --git a/packages/core/admin/admin/src/content-manager/components/InputUID/index.js b/packages/core/admin/admin/src/content-manager/components/InputUID/index.js index ea443a1382..8bd70bbc65 100644 --- a/packages/core/admin/admin/src/content-manager/components/InputUID/index.js +++ b/packages/core/admin/admin/src/content-manager/components/InputUID/index.js @@ -79,6 +79,9 @@ const InputUID = ({ field: name, data: modifiedData, }); + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function postClient' + ); onChange({ target: { name, value: data, type: 'text' } }, shouldSetInitialValue); setIsLoading(false); } catch (err) { @@ -101,6 +104,9 @@ const InputUID = ({ field: name, value: value ? value.trim() : '', }); + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function postClient' + ); setAvailability(data); diff --git a/packages/core/admin/admin/src/content-manager/components/SingleTypeFormWrapper/index.js b/packages/core/admin/admin/src/content-manager/components/SingleTypeFormWrapper/index.js index 2ac0523287..f3c451aa1c 100644 --- a/packages/core/admin/admin/src/content-manager/components/SingleTypeFormWrapper/index.js +++ b/packages/core/admin/admin/src/content-manager/components/SingleTypeFormWrapper/index.js @@ -106,6 +106,9 @@ const SingleTypeFormWrapper = ({ allLayoutData, children, slug }) => { const { data } = await axiosInstance(getRequestUrl(`${slug}${searchToSend}`), { cancelToken: source.token, }); + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function getClient' + ); dispatch(getDataSucceeded(cleanReceivedData(data))); @@ -161,6 +164,9 @@ const SingleTypeFormWrapper = ({ allLayoutData, children, slug }) => { trackUsageRef.current('willDeleteEntry', trackerProperty); const { data } = await axiosInstance.delete(getRequestUrl(`${slug}${searchToSend}`)); + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function deleteClient' + ); toggleNotification({ type: 'success', @@ -195,6 +201,9 @@ const SingleTypeFormWrapper = ({ allLayoutData, children, slug }) => { dispatch(setStatus('submit-pending')); const { data } = await axiosInstance.put(endPoint, body); + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function putClient' + ); trackUsageRef.current('didCreateEntry', trackerProperty); toggleNotification({ @@ -243,6 +252,9 @@ const SingleTypeFormWrapper = ({ allLayoutData, children, slug }) => { dispatch(setStatus('draft-relation-check-pending')); const numberOfDraftRelations = await axiosInstance.get(endPoint); + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function getClient' + ); trackUsageRef.current('didCheckDraftRelations'); dispatch(setStatus('resolved')); @@ -264,6 +276,9 @@ const SingleTypeFormWrapper = ({ allLayoutData, children, slug }) => { dispatch(setStatus('publish-pending')); const { data } = await axiosInstance.post(endPoint); + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function postClient' + ); trackUsageRef.current('didPublishEntry'); toggleNotification({ @@ -295,6 +310,9 @@ const SingleTypeFormWrapper = ({ allLayoutData, children, slug }) => { dispatch(setStatus('submit-pending')); const { data } = await axiosInstance.put(endPoint, body); + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function putClient' + ); toggleNotification({ type: 'success', @@ -334,6 +352,9 @@ const SingleTypeFormWrapper = ({ allLayoutData, children, slug }) => { trackUsageRef.current('willUnpublishEntry'); const { data } = await axiosInstance.post(endPoint); + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function postClient' + ); trackUsageRef.current('didUnpublishEntry'); toggleNotification({ diff --git a/packages/core/admin/admin/src/content-manager/hooks/useFetchContentTypeLayout/index.js b/packages/core/admin/admin/src/content-manager/hooks/useFetchContentTypeLayout/index.js index f479b4b3c0..603caf4e47 100644 --- a/packages/core/admin/admin/src/content-manager/hooks/useFetchContentTypeLayout/index.js +++ b/packages/core/admin/admin/src/content-manager/hooks/useFetchContentTypeLayout/index.js @@ -28,6 +28,9 @@ const useFetchContentTypeLayout = (contentTypeUID) => { const { data: { data }, } = await axiosInstance.get(endPoint, { cancelToken: source.token }); + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function getClient' + ); dispatch({ type: 'GET_DATA_SUCCEEDED', diff --git a/packages/core/admin/admin/src/content-manager/hooks/useRelation/useRelation.js b/packages/core/admin/admin/src/content-manager/hooks/useRelation/useRelation.js index 4090f436ea..7736692b45 100644 --- a/packages/core/admin/admin/src/content-manager/hooks/useRelation/useRelation.js +++ b/packages/core/admin/admin/src/content-manager/hooks/useRelation/useRelation.js @@ -19,6 +19,9 @@ export const useRelation = (cacheKey, { name, relation, search }) => { page: pageParam, }, }); + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function getClient' + ); setCurrentPage(pageParam); @@ -37,6 +40,9 @@ export const useRelation = (cacheKey, { name, relation, search }) => { page: pageParam, }, }); + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function getClient' + ); return data; } catch (err) { diff --git a/packages/core/admin/admin/src/content-manager/pages/App/useModels.js b/packages/core/admin/admin/src/content-manager/pages/App/useModels.js index 382114690a..e3e5d0fa98 100644 --- a/packages/core/admin/admin/src/content-manager/pages/App/useModels.js +++ b/packages/core/admin/admin/src/content-manager/pages/App/useModels.js @@ -39,6 +39,9 @@ const useModels = () => { axiosInstance.get(getRequestUrl(endPoint), { cancelToken: source.token }) ) ); + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function getClient' + ); notifyStatus( formatMessage({ diff --git a/packages/core/admin/admin/src/content-manager/pages/App/utils/getContentTypeLinks.js b/packages/core/admin/admin/src/content-manager/pages/App/utils/getContentTypeLinks.js index 1e7e7c7823..d517aa5359 100644 --- a/packages/core/admin/admin/src/content-manager/pages/App/utils/getContentTypeLinks.js +++ b/packages/core/admin/admin/src/content-manager/pages/App/utils/getContentTypeLinks.js @@ -8,6 +8,9 @@ const getContentTypeLinks = async (models, userPermissions, toggleNotification) const { data: { data: contentTypeConfigurations }, } = await axiosInstance.get(getRequestUrl('content-types-settings')); + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function getClient' + ); const { collectionTypesSectionLinks, singleTypesSectionLinks } = generateModelsLinks( models, diff --git a/packages/core/admin/admin/src/content-manager/pages/ComponentSetttingsView/index.js b/packages/core/admin/admin/src/content-manager/pages/ComponentSetttingsView/index.js index 8480c5f2db..46e3786a83 100644 --- a/packages/core/admin/admin/src/content-manager/pages/ComponentSetttingsView/index.js +++ b/packages/core/admin/admin/src/content-manager/pages/ComponentSetttingsView/index.js @@ -32,6 +32,9 @@ const ComponentSettingsView = () => { } = await axiosInstance.get(getRequestUrl(`components/${uid}/configuration`), { cancelToken: source.token, }); + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function getClient' + ); dispatch(getDataSucceeded(mergeMetasWithSchema(data, schemas, 'component'))); } catch (err) { diff --git a/packages/core/admin/admin/src/content-manager/pages/EditSettingsView/utils/api.js b/packages/core/admin/admin/src/content-manager/pages/EditSettingsView/utils/api.js index f99179eff2..fe3791cd65 100644 --- a/packages/core/admin/admin/src/content-manager/pages/EditSettingsView/utils/api.js +++ b/packages/core/admin/admin/src/content-manager/pages/EditSettingsView/utils/api.js @@ -2,6 +2,10 @@ import { axiosInstance } from '../../../../core/utils'; import { getRequestUrl } from '../../../utils'; const putCMSettingsEV = (body, slug, isContentTypeView) => { + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function putClient' + ); + return axiosInstance.put( getRequestUrl( isContentTypeView ? `content-types/${slug}/configuration` : `components/${slug}/configuration` diff --git a/packages/core/admin/admin/src/content-manager/pages/ListSettingsView/utils/api.js b/packages/core/admin/admin/src/content-manager/pages/ListSettingsView/utils/api.js index 837871421f..e853f84813 100644 --- a/packages/core/admin/admin/src/content-manager/pages/ListSettingsView/utils/api.js +++ b/packages/core/admin/admin/src/content-manager/pages/ListSettingsView/utils/api.js @@ -2,6 +2,10 @@ import { axiosInstance } from '../../../../core/utils'; import { getRequestUrl } from '../../../utils'; const putCMSettingsLV = (body, slug) => { + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function putClient' + ); + return axiosInstance.put(getRequestUrl(`content-types/${slug}/configuration`), body); }; diff --git a/packages/core/admin/admin/src/content-manager/pages/ListView/index.js b/packages/core/admin/admin/src/content-manager/pages/ListView/index.js index 354f1cfb20..357ed5d89e 100644 --- a/packages/core/admin/admin/src/content-manager/pages/ListView/index.js +++ b/packages/core/admin/admin/src/content-manager/pages/ListView/index.js @@ -113,6 +113,9 @@ function ListView({ const { data: { results, pagination: paginationResult }, } = await axiosInstance.get(endPoint, opts); + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function getClient' + ); notifyStatus( formatMessage( @@ -160,6 +163,9 @@ function ListView({ const handleConfirmDeleteAllData = useCallback( async (ids) => { try { + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function postClient' + ); await axiosInstance.post(getRequestUrl(`collection-types/${slug}/actions/bulkDelete`), { ids, }); @@ -181,6 +187,9 @@ function ListView({ async (idToDelete) => { try { await axiosInstance.delete(getRequestUrl(`collection-types/${slug}/${idToDelete}`)); + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function deleteClient' + ); const requestUrl = getRequestUrl(`collection-types/${slug}${params}`); fetchData(requestUrl); diff --git a/packages/core/admin/admin/src/hooks/useFetchEnabledPlugins/utils/api.js b/packages/core/admin/admin/src/hooks/useFetchEnabledPlugins/utils/api.js index dfd1580ff1..0e9cb2be0d 100644 --- a/packages/core/admin/admin/src/hooks/useFetchEnabledPlugins/utils/api.js +++ b/packages/core/admin/admin/src/hooks/useFetchEnabledPlugins/utils/api.js @@ -2,6 +2,9 @@ import { axiosInstance } from '../../../core/utils'; const fetchEnabledPlugins = async () => { const { data } = await axiosInstance.get('/admin/plugins'); + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function getClient' + ); return data; }; diff --git a/packages/core/admin/admin/src/hooks/useRegenerate/index.js b/packages/core/admin/admin/src/hooks/useRegenerate/index.js index bec18b673f..701576ee65 100644 --- a/packages/core/admin/admin/src/hooks/useRegenerate/index.js +++ b/packages/core/admin/admin/src/hooks/useRegenerate/index.js @@ -14,6 +14,9 @@ const useRegenerate = (id, onRegenerate) => { data: { accessKey }, }, } = await axiosInstance.post(`/admin/api-tokens/${id}/regenerate`); + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function postClient' + ); setIsLoadingConfirmation(false); onRegenerate(accessKey); } catch (error) { diff --git a/packages/core/admin/admin/src/hooks/useRolesList/index.js b/packages/core/admin/admin/src/hooks/useRolesList/index.js index a96cc913fd..06b7a20a38 100644 --- a/packages/core/admin/admin/src/hooks/useRolesList/index.js +++ b/packages/core/admin/admin/src/hooks/useRolesList/index.js @@ -27,6 +27,9 @@ const useRolesList = (shouldFetchData = true) => { const { data: { data }, } = await axiosInstance.get('/admin/roles'); + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function getClient' + ); dispatch({ type: 'GET_DATA_SUCCEEDED', diff --git a/packages/core/admin/admin/src/index.js b/packages/core/admin/admin/src/index.js index ee26bfc9a2..40622f2ea0 100644 --- a/packages/core/admin/admin/src/index.js +++ b/packages/core/admin/admin/src/index.js @@ -34,6 +34,9 @@ const run = async () => { data: { isEE, features }, }, } = await axiosInstance.get('/admin/project-type'); + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function getClient' + ); window.strapi.isEE = isEE; window.strapi.features = { diff --git a/packages/core/admin/admin/src/pages/ProfilePage/utils/api.js b/packages/core/admin/admin/src/pages/ProfilePage/utils/api.js index 7d7475eef7..cbafb06f75 100644 --- a/packages/core/admin/admin/src/pages/ProfilePage/utils/api.js +++ b/packages/core/admin/admin/src/pages/ProfilePage/utils/api.js @@ -2,6 +2,9 @@ import omit from 'lodash/omit'; import { axiosInstance } from '../../../core/utils'; const fetchUser = async () => { + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function getClient' + ); const { data } = await axiosInstance.get('/admin/users/me'); return data.data; @@ -9,6 +12,9 @@ const fetchUser = async () => { const putUser = async (body) => { const dataToSend = omit(body, ['confirmPassword', 'currentTheme']); + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function putClient' + ); const { data } = await axiosInstance.put('/admin/users/me', dataToSend); return { ...data.data, currentTheme: body.currentTheme }; diff --git a/packages/core/admin/admin/src/pages/SettingsPage/pages/ApiTokens/ListView/index.js b/packages/core/admin/admin/src/pages/SettingsPage/pages/ApiTokens/ListView/index.js index d668a28851..11bb0fc9ce 100644 --- a/packages/core/admin/admin/src/pages/SettingsPage/pages/ApiTokens/ListView/index.js +++ b/packages/core/admin/admin/src/pages/SettingsPage/pages/ApiTokens/ListView/index.js @@ -68,6 +68,9 @@ const ApiTokenListView = () => { const { data: { data }, } = await axiosInstance.get(`/admin/api-tokens`); + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function getClient' + ); trackUsage('didAccessTokenList', { number: data.length }); @@ -90,6 +93,9 @@ const ApiTokenListView = () => { const deleteMutation = useMutation( async (id) => { + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function deleteClient' + ); await axiosInstance.delete(`/admin/api-tokens/${id}`); }, { diff --git a/packages/core/admin/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/api.js b/packages/core/admin/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/api.js index c68b6ee87a..09b2616800 100644 --- a/packages/core/admin/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/api.js +++ b/packages/core/admin/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/api.js @@ -3,12 +3,18 @@ import prefixAllUrls from './prefixAllUrls'; const fetchProjectSettings = async () => { const { data } = await axiosInstance.get('/admin/project-settings'); + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function getClient' + ); return prefixAllUrls(data); }; const postProjectSettings = async (body) => { const { data } = await axiosInstance.post('/admin/project-settings', body); + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function postClient' + ); return prefixAllUrls(data); }; diff --git a/packages/core/admin/admin/src/pages/SettingsPage/pages/Users/EditPage/utils/api.js b/packages/core/admin/admin/src/pages/SettingsPage/pages/Users/EditPage/utils/api.js index 5561f3df3f..71b1fa778f 100644 --- a/packages/core/admin/admin/src/pages/SettingsPage/pages/Users/EditPage/utils/api.js +++ b/packages/core/admin/admin/src/pages/SettingsPage/pages/Users/EditPage/utils/api.js @@ -2,12 +2,18 @@ import { axiosInstance } from '../../../../../../core/utils'; const fetchUser = async (id) => { const { data } = await axiosInstance.get(`/admin/users/${id}`); + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function getClient' + ); return data.data; }; const putUser = async (id, body) => { const { data } = await axiosInstance.put(`/admin/users/${id}`, body); + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function putClient' + ); return data.data; }; diff --git a/packages/core/admin/admin/src/pages/SettingsPage/pages/Users/ListPage/ModalForm/index.js b/packages/core/admin/admin/src/pages/SettingsPage/pages/Users/ListPage/ModalForm/index.js index 46b5db5104..7349e3174d 100644 --- a/packages/core/admin/admin/src/pages/SettingsPage/pages/Users/ListPage/ModalForm/index.js +++ b/packages/core/admin/admin/src/pages/SettingsPage/pages/Users/ListPage/ModalForm/index.js @@ -34,27 +34,36 @@ const ModalForm = ({ queryName, onToggle }) => { const { formatMessage } = useIntl(); const toggleNotification = useNotification(); const { lockApp, unlockApp } = useOverlayBlocker(); - const postMutation = useMutation((body) => axiosInstance.post('/admin/users', body), { - async onSuccess({ data }) { - setRegistrationToken(data.data.registrationToken); - await queryClient.invalidateQueries(queryName); - goNext(); - setIsSubmitting(false); - }, - onError(err) { - setIsSubmitting(false); + const postMutation = useMutation( + (body) => { + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function postClient' + ); - toggleNotification({ - type: 'warning', - message: { id: 'notification.error', defaultMessage: 'An error occured' }, - }); + return axiosInstance.post('/admin/users', body); + }, + { + async onSuccess({ data }) { + setRegistrationToken(data.data.registrationToken); + await queryClient.invalidateQueries(queryName); + goNext(); + setIsSubmitting(false); + }, + onError(err) { + setIsSubmitting(false); - throw err; - }, - onSettled() { - unlockApp(); - }, - }); + toggleNotification({ + type: 'warning', + message: { id: 'notification.error', defaultMessage: 'An error occured' }, + }); + + throw err; + }, + onSettled() { + unlockApp(); + }, + } + ); const headerTitle = formatMessage({ id: 'Settings.permissions.users.create', diff --git a/packages/core/admin/admin/src/pages/SettingsPage/pages/Users/ListPage/utils/api.js b/packages/core/admin/admin/src/pages/SettingsPage/pages/Users/ListPage/utils/api.js index ca694e07f2..c181400545 100644 --- a/packages/core/admin/admin/src/pages/SettingsPage/pages/Users/ListPage/utils/api.js +++ b/packages/core/admin/admin/src/pages/SettingsPage/pages/Users/ListPage/utils/api.js @@ -4,6 +4,9 @@ const fetchData = async (search, notify) => { const { data: { data }, } = await axiosInstance.get(`/admin/users${search}`); + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function getClient' + ); notify(); @@ -11,6 +14,10 @@ const fetchData = async (search, notify) => { }; const deleteData = async (ids) => { + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function postClient' + ); + await axiosInstance.post('/admin/users/batch-delete', { ids }); }; diff --git a/packages/core/admin/admin/src/pages/SettingsPage/pages/Users/components/SelectRoles/index.js b/packages/core/admin/admin/src/pages/SettingsPage/pages/Users/components/SelectRoles/index.js index 63b9489929..6fb13b9808 100644 --- a/packages/core/admin/admin/src/pages/SettingsPage/pages/Users/components/SelectRoles/index.js +++ b/packages/core/admin/admin/src/pages/SettingsPage/pages/Users/components/SelectRoles/index.js @@ -28,6 +28,9 @@ const Loader = () => ( const fetchData = async () => { const { data } = await axiosInstance.get('/admin/roles'); + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function getClient' + ); return data.data; }; diff --git a/packages/core/admin/admin/src/pages/SettingsPage/pages/Webhooks/EditView/index.js b/packages/core/admin/admin/src/pages/SettingsPage/pages/Webhooks/EditView/index.js index 8a2951d1b1..c628420d9e 100644 --- a/packages/core/admin/admin/src/pages/SettingsPage/pages/Webhooks/EditView/index.js +++ b/packages/core/admin/admin/src/pages/SettingsPage/pages/Webhooks/EditView/index.js @@ -64,7 +64,13 @@ const EditView = () => { data: triggerResponse, isIdle: isTriggerIdle, mutate, - } = useMutation(() => axiosInstance.post(`/admin/webhooks/${id}/trigger`)); + } = useMutation(() => { + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function postClient' + ); + + return axiosInstance.post(`/admin/webhooks/${id}/trigger`); + }); const triggerWebhook = () => mutate(null, { diff --git a/packages/core/admin/ee/admin/pages/SettingsPage/pages/Roles/ListPage/index.js b/packages/core/admin/ee/admin/pages/SettingsPage/pages/Roles/ListPage/index.js index c80404f07d..4208e58c7d 100644 --- a/packages/core/admin/ee/admin/pages/SettingsPage/pages/Roles/ListPage/index.js +++ b/packages/core/admin/ee/admin/pages/SettingsPage/pages/Roles/ListPage/index.js @@ -78,6 +78,9 @@ const useRoleActions = ({ getData, canCreate, canDelete, canUpdate }) => { type: 'ON_REMOVE_ROLES', }); + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function postClient' + ); await axiosInstance.post('/admin/roles/batch-delete', { ids: [roleToDelete], }); diff --git a/packages/core/content-type-builder/admin/src/components/DataManagerProvider/index.js b/packages/core/content-type-builder/admin/src/components/DataManagerProvider/index.js index f92b694e32..5ce9c11685 100644 --- a/packages/core/content-type-builder/admin/src/components/DataManagerProvider/index.js +++ b/packages/core/content-type-builder/admin/src/components/DataManagerProvider/index.js @@ -108,6 +108,10 @@ const DataManagerProvider = ({ { data: reservedNames }, ] = await Promise.all( ['components', 'content-types', 'reserved-names'].map((endPoint) => { + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function getClient' + ); + return axiosInstance.get(endPoint); }) ); @@ -315,7 +319,9 @@ const DataManagerProvider = ({ } lockAppWithAutoreload(); - + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function deleteClient' + ); await axiosInstance.delete(requestURL); // Make sure the server has restarted @@ -349,6 +355,9 @@ const DataManagerProvider = ({ lockAppWithAutoreload(); // Update the category + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function putClient' + ); await axiosInstance({ url: requestURL, method: 'PUT', data: body }); // Make sure the server has restarted @@ -507,6 +516,10 @@ const DataManagerProvider = ({ // Lock the app lockAppWithAutoreload(); + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function postClient or the putClient' + ); + await axiosInstance({ url: requestURL, method, diff --git a/packages/core/email/admin/src/pages/Settings/utils/api.js b/packages/core/email/admin/src/pages/Settings/utils/api.js index b2353b24d8..e6640c89e3 100644 --- a/packages/core/email/admin/src/pages/Settings/utils/api.js +++ b/packages/core/email/admin/src/pages/Settings/utils/api.js @@ -1,12 +1,18 @@ import axiosInstance from '../../../utils/axiosInstance'; const fetchEmailSettings = async () => { + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function getClient' + ); const { data } = await axiosInstance.get('/email/settings'); return data.config; }; const postEmailTest = async (body) => { + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function postClient' + ); await axiosInstance.post('/email/test', body); }; diff --git a/packages/core/upload/admin/src/hooks/useAssets.js b/packages/core/upload/admin/src/hooks/useAssets.js index 51931619e8..3031aa7411 100644 --- a/packages/core/upload/admin/src/hooks/useAssets.js +++ b/packages/core/upload/admin/src/hooks/useAssets.js @@ -47,6 +47,9 @@ export const useAssets = ({ skipWhen = false, query = {} } = {}) => { addQueryPrefix: true, })}` ); + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function getClient' + ); notifyStatus( formatMessage({ diff --git a/packages/core/upload/admin/src/hooks/useBulkMove.js b/packages/core/upload/admin/src/hooks/useBulkMove.js index 0e34eda46f..246d63cd1f 100644 --- a/packages/core/upload/admin/src/hooks/useBulkMove.js +++ b/packages/core/upload/admin/src/hooks/useBulkMove.js @@ -22,6 +22,9 @@ export const useBulkMove = () => { return acc; }, {}); + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function postClient' + ); return axiosInstance.post(url, { ...payload, destinationFolderId }); }; diff --git a/packages/core/upload/admin/src/hooks/useBulkRemove.js b/packages/core/upload/admin/src/hooks/useBulkRemove.js index c98102d95f..eb02e7e1b2 100644 --- a/packages/core/upload/admin/src/hooks/useBulkRemove.js +++ b/packages/core/upload/admin/src/hooks/useBulkRemove.js @@ -22,6 +22,9 @@ export const useBulkRemove = () => { return acc; }, {}); + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function postClient' + ); return axiosInstance.post(url, payload); }; diff --git a/packages/core/upload/admin/src/hooks/useEditAsset.js b/packages/core/upload/admin/src/hooks/useEditAsset.js index 01eb8f0759..9fec10fb98 100644 --- a/packages/core/upload/admin/src/hooks/useEditAsset.js +++ b/packages/core/upload/admin/src/hooks/useEditAsset.js @@ -26,6 +26,10 @@ const editAssetRequest = (asset, file, cancelToken, onProgress) => { }) ); + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function postClient' + ); + return axiosInstance({ method: 'post', url: endpoint, diff --git a/packages/core/upload/admin/src/hooks/useEditFolder.js b/packages/core/upload/admin/src/hooks/useEditFolder.js index e9a842be4e..daee7a02b1 100644 --- a/packages/core/upload/admin/src/hooks/useEditFolder.js +++ b/packages/core/upload/admin/src/hooks/useEditFolder.js @@ -8,6 +8,10 @@ const editFolderRequest = ({ attrs, id }) => { const method = isEditing ? 'put' : 'post'; const url = getRequestUrl(`folders/${id ?? ''}`); + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function putClient or the postClient' + ); + return axiosInstance[method](url, attrs).then((res) => res.data); }; diff --git a/packages/core/upload/admin/src/hooks/useFolder.js b/packages/core/upload/admin/src/hooks/useFolder.js index 753e408c05..5370e58870 100644 --- a/packages/core/upload/admin/src/hooks/useFolder.js +++ b/packages/core/upload/admin/src/hooks/useFolder.js @@ -13,6 +13,9 @@ export const useFolder = (id, { enabled = true }) => { const { data } = await axiosInstance.get( `${dataRequestURL}/${id}?populate[parent][populate][parent]=*` ); + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function getClient' + ); return data.data; } catch (err) { diff --git a/packages/core/upload/admin/src/hooks/useFolderStructure.js b/packages/core/upload/admin/src/hooks/useFolderStructure.js index 18e339c2fe..8fd74a3d79 100644 --- a/packages/core/upload/admin/src/hooks/useFolderStructure.js +++ b/packages/core/upload/admin/src/hooks/useFolderStructure.js @@ -18,6 +18,9 @@ export const useFolderStructure = ({ enabled = true } = {}) => { const { data: { data }, } = await axiosInstance.get(dataRequestURL); + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function getClient' + ); const children = data.map((f) => recursiveRenameKeys(f, (key) => FIELD_MAPPING?.[key] ?? key)); diff --git a/packages/core/upload/admin/src/hooks/useFolders.js b/packages/core/upload/admin/src/hooks/useFolders.js index 58eb1ad794..3b7ed4edfa 100644 --- a/packages/core/upload/admin/src/hooks/useFolders.js +++ b/packages/core/upload/admin/src/hooks/useFolders.js @@ -50,6 +50,9 @@ export const useFolders = ({ enabled = true, query = {} }) => { const { data } = await axiosInstance.get( `${dataRequestURL}?${stringify(params, { encode: false })}` ); + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function getClient' + ); notifyStatus( formatMessage({ diff --git a/packages/core/upload/admin/src/hooks/useUpload.js b/packages/core/upload/admin/src/hooks/useUpload.js index d05f80e3df..677ceb2d4e 100644 --- a/packages/core/upload/admin/src/hooks/useUpload.js +++ b/packages/core/upload/admin/src/hooks/useUpload.js @@ -24,6 +24,10 @@ const uploadAsset = (asset, folderId, cancelToken, onProgress) => { }) ); + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function postClient' + ); + return axiosInstance({ method: 'post', url: endpoint, diff --git a/packages/core/upload/admin/src/pages/SettingsPage/index.js b/packages/core/upload/admin/src/pages/SettingsPage/index.js index 144e682657..e8f06a2709 100644 --- a/packages/core/upload/admin/src/pages/SettingsPage/index.js +++ b/packages/core/upload/admin/src/pages/SettingsPage/index.js @@ -50,6 +50,9 @@ export const SettingsPage = () => { } = await axiosInstance.get(getRequestUrl('settings'), { cancelToken: source.token, }); + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function getClient' + ); dispatch({ type: 'GET_DATA_SUCCEEDED', @@ -86,6 +89,9 @@ export const SettingsPage = () => { try { await axiosInstance.put(getRequestUrl('settings'), modifiedData); + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function putClient' + ); dispatch({ type: 'SUBMIT_SUCCEEDED', diff --git a/packages/core/upload/admin/src/utils/deleteRequest.js b/packages/core/upload/admin/src/utils/deleteRequest.js index 9202475de6..7cec513644 100644 --- a/packages/core/upload/admin/src/utils/deleteRequest.js +++ b/packages/core/upload/admin/src/utils/deleteRequest.js @@ -4,5 +4,9 @@ import getRequestUrl from './getRequestUrl'; export const deleteRequest = (type, id) => { const url = getRequestUrl(`/${type}/${id}`); + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function deleteClient' + ); + return axiosInstance.delete(url); }; diff --git a/packages/plugins/i18n/admin/src/components/CMEditViewInjectedComponents/CMEditViewCopyLocale/index.js b/packages/plugins/i18n/admin/src/components/CMEditViewInjectedComponents/CMEditViewCopyLocale/index.js index 86e3fe376d..3af22298b6 100644 --- a/packages/plugins/i18n/admin/src/components/CMEditViewInjectedComponents/CMEditViewCopyLocale/index.js +++ b/packages/plugins/i18n/admin/src/components/CMEditViewInjectedComponents/CMEditViewCopyLocale/index.js @@ -62,6 +62,9 @@ const Content = ({ appLocales, currentLocale, localizations, readPermissions }) setIsLoading(true); try { const { data: response } = await axiosInstance.get(requestURL); + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function getClient' + ); const cleanedData = cleanData(response, allLayoutData, localizations); ['createdBy', 'updatedBy', 'publishedAt', 'id', 'createdAt'].forEach((key) => { diff --git a/packages/plugins/users-permissions/admin/src/hooks/useFetchRole/index.js b/packages/plugins/users-permissions/admin/src/hooks/useFetchRole/index.js index febfed35b7..4e1167bc51 100644 --- a/packages/plugins/users-permissions/admin/src/hooks/useFetchRole/index.js +++ b/packages/plugins/users-permissions/admin/src/hooks/useFetchRole/index.js @@ -1,7 +1,7 @@ import { useCallback, useReducer, useEffect, useRef } from 'react'; import { useNotification } from '@strapi/helper-plugin'; import reducer, { initialState } from './reducer'; -import axiosIntance from '../../utils/axiosInstance'; +import axiosInstance from '../../utils/axiosInstance'; import pluginId from '../../pluginId'; const useFetchRole = (id) => { @@ -29,7 +29,10 @@ const useFetchRole = (id) => { try { const { data: { role }, - } = await axiosIntance.get(`/${pluginId}/roles/${roleId}`); + } = await axiosInstance.get(`/${pluginId}/roles/${roleId}`); + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function getClient' + ); // Prevent updating state on an unmounted component if (isMounted.current) { diff --git a/packages/plugins/users-permissions/admin/src/hooks/usePlugins/index.js b/packages/plugins/users-permissions/admin/src/hooks/usePlugins/index.js index ee6893fb77..e60cafbed7 100644 --- a/packages/plugins/users-permissions/admin/src/hooks/usePlugins/index.js +++ b/packages/plugins/users-permissions/admin/src/hooks/usePlugins/index.js @@ -22,6 +22,9 @@ const usePlugins = (shouldFetchData = true) => { const [{ permissions }, { routes }] = await Promise.all( [`/${pluginId}/permissions`, `/${pluginId}/routes`].map(async (endpoint) => { const res = await axiosInstance.get(endpoint); + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function getClient' + ); return res.data; }) diff --git a/packages/plugins/users-permissions/admin/src/pages/AdvancedSettings/utils/api.js b/packages/plugins/users-permissions/admin/src/pages/AdvancedSettings/utils/api.js index 9e644114a8..4c61061cd7 100644 --- a/packages/plugins/users-permissions/admin/src/pages/AdvancedSettings/utils/api.js +++ b/packages/plugins/users-permissions/admin/src/pages/AdvancedSettings/utils/api.js @@ -1,12 +1,19 @@ import { axiosInstance, getRequestURL } from '../../../utils'; const fetchData = async () => { + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function getClient' + ); const { data } = await axiosInstance.get(getRequestURL('advanced')); return data; }; const putAdvancedSettings = (body) => { + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function putClient' + ); + return axiosInstance.put(getRequestURL('advanced'), body); }; diff --git a/packages/plugins/users-permissions/admin/src/pages/EmailTemplates/utils/api.js b/packages/plugins/users-permissions/admin/src/pages/EmailTemplates/utils/api.js index 6c3c03368f..ec95e6fa09 100644 --- a/packages/plugins/users-permissions/admin/src/pages/EmailTemplates/utils/api.js +++ b/packages/plugins/users-permissions/admin/src/pages/EmailTemplates/utils/api.js @@ -2,11 +2,18 @@ import { axiosInstance, getRequestURL } from '../../../utils'; const fetchData = async () => { const { data } = await axiosInstance.get(getRequestURL('email-templates')); + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function getClient' + ); return data; }; const putEmailTemplate = (body) => { + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function putClient' + ); + return axiosInstance.put(getRequestURL('email-templates'), body); }; diff --git a/packages/plugins/users-permissions/admin/src/pages/Providers/utils/api.js b/packages/plugins/users-permissions/admin/src/pages/Providers/utils/api.js index 9373a46f04..7bc9d22583 100644 --- a/packages/plugins/users-permissions/admin/src/pages/Providers/utils/api.js +++ b/packages/plugins/users-permissions/admin/src/pages/Providers/utils/api.js @@ -4,6 +4,9 @@ import { getRequestURL, axiosInstance } from '../../../utils'; export const fetchData = async (toggleNotification) => { try { const { data } = await axiosInstance.get(getRequestURL('providers')); + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function getClient' + ); return data; } catch (err) { @@ -17,5 +20,9 @@ export const fetchData = async (toggleNotification) => { }; export const putProvider = (body) => { + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function putClient' + ); + return axiosInstance.put(getRequestURL('providers'), body); }; diff --git a/packages/plugins/users-permissions/admin/src/pages/Roles/CreatePage/index.js b/packages/plugins/users-permissions/admin/src/pages/Roles/CreatePage/index.js index 39a2d17b68..4f893583ed 100644 --- a/packages/plugins/users-permissions/admin/src/pages/Roles/CreatePage/index.js +++ b/packages/plugins/users-permissions/admin/src/pages/Roles/CreatePage/index.js @@ -44,6 +44,9 @@ const EditPage = () => { const permissions = permissionsRef.current.getPermissions(); // Update role in Strapi await axiosInstance.post(`/${pluginId}/roles`, { ...data, ...permissions, users: [] }); + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function postClient' + ); // Notify success trackUsage('didCreateRole'); toggleNotification({ diff --git a/packages/plugins/users-permissions/admin/src/pages/Roles/EditPage/index.js b/packages/plugins/users-permissions/admin/src/pages/Roles/EditPage/index.js index 3e4e781412..cf8e204e6e 100644 --- a/packages/plugins/users-permissions/admin/src/pages/Roles/EditPage/index.js +++ b/packages/plugins/users-permissions/admin/src/pages/Roles/EditPage/index.js @@ -48,6 +48,9 @@ const EditPage = () => { const permissions = permissionsRef.current.getPermissions(); // Update role in Strapi await axiosInstance.put(`/${pluginId}/roles/${id}`, { ...data, ...permissions, users: [] }); + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function putClient' + ); // Notify success onSubmitSucceeded({ name: data.name, description: data.description }); toggleNotification({ diff --git a/packages/plugins/users-permissions/admin/src/pages/Roles/ListPage/utils/api.js b/packages/plugins/users-permissions/admin/src/pages/Roles/ListPage/utils/api.js index f9bb69544b..66ef258d30 100644 --- a/packages/plugins/users-permissions/admin/src/pages/Roles/ListPage/utils/api.js +++ b/packages/plugins/users-permissions/admin/src/pages/Roles/ListPage/utils/api.js @@ -3,6 +3,9 @@ import { getRequestURL, axiosInstance } from '../../../../utils'; export const fetchData = async (toggleNotification, notifyStatus) => { try { const { data } = await axiosInstance.get(getRequestURL('roles')); + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function getClient' + ); notifyStatus('The roles have loaded successfully'); return data; @@ -19,6 +22,9 @@ export const fetchData = async (toggleNotification, notifyStatus) => { export const deleteData = async (id, toggleNotification) => { try { await axiosInstance.delete(`${getRequestURL('roles')}/${id}`); + console.warn( + 'Deprecation warning: Usage of "axiosInstance" utility is deprecated. This is discouraged and will be removed in the next major release. Please use instead the useFetchClient hook inside the helper plugin and its function deleteClient' + ); } catch (error) { toggleNotification({ type: 'warning',