mirror of
https://github.com/strapi/strapi.git
synced 2025-10-28 08:32:08 +00:00
add deprecation warnings where we use axiosInstance
This commit is contained in:
parent
8161eb9bf8
commit
2bd1a06e9c
@ -39,6 +39,9 @@ const fetchStrapiLatestRelease = async (toggleNotification) => {
|
|||||||
const fetchAppInfo = async () => {
|
const fetchAppInfo = async () => {
|
||||||
try {
|
try {
|
||||||
const { data, headers } = await axiosInstance.get('/admin/information');
|
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')) {
|
if (!headers['content-type'].includes('application/json')) {
|
||||||
throw new Error('Not found');
|
throw new Error('Not found');
|
||||||
@ -53,6 +56,9 @@ const fetchAppInfo = async () => {
|
|||||||
const fetchCurrentUserPermissions = async () => {
|
const fetchCurrentUserPermissions = async () => {
|
||||||
try {
|
try {
|
||||||
const { data, headers } = await axiosInstance.get('/admin/users/me/permissions');
|
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')) {
|
if (!headers['content-type'].includes('application/json')) {
|
||||||
throw new Error('Not found');
|
throw new Error('Not found');
|
||||||
@ -71,6 +77,9 @@ const fetchUserRoles = async () => {
|
|||||||
data: { roles },
|
data: { roles },
|
||||||
},
|
},
|
||||||
} = await axiosInstance.get('/admin/users/me');
|
} = 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;
|
return roles;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
@ -138,6 +138,9 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin }
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const { data } = await axiosInstance.get(requestURL, { cancelToken: source.token });
|
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))));
|
dispatch(getDataSucceeded(cleanReceivedData(cleanClonedData(data))));
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@ -222,6 +225,9 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin }
|
|||||||
const { data } = await axiosInstance.delete(
|
const { data } = await axiosInstance.delete(
|
||||||
getRequestUrl(`collection-types/${slug}/${id}`)
|
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({
|
toggleNotification({
|
||||||
type: 'success',
|
type: 'success',
|
||||||
@ -253,6 +259,9 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin }
|
|||||||
dispatch(setStatus('submit-pending'));
|
dispatch(setStatus('submit-pending'));
|
||||||
|
|
||||||
const { data } = await axiosInstance.post(endPoint, body);
|
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);
|
trackUsageRef.current('didCreateEntry', trackerProperty);
|
||||||
toggleNotification({
|
toggleNotification({
|
||||||
@ -304,6 +313,9 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin }
|
|||||||
dispatch(setStatus('draft-relation-check-pending'));
|
dispatch(setStatus('draft-relation-check-pending'));
|
||||||
|
|
||||||
const numberOfDraftRelations = await axiosInstance.get(endPoint);
|
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');
|
trackUsageRef.current('didCheckDraftRelations');
|
||||||
|
|
||||||
dispatch(setStatus('resolved'));
|
dispatch(setStatus('resolved'));
|
||||||
@ -325,6 +337,9 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin }
|
|||||||
dispatch(setStatus('publish-pending'));
|
dispatch(setStatus('publish-pending'));
|
||||||
|
|
||||||
const { data } = await axiosInstance.post(endPoint);
|
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');
|
trackUsageRef.current('didPublishEntry');
|
||||||
|
|
||||||
@ -355,6 +370,9 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin }
|
|||||||
dispatch(setStatus('submit-pending'));
|
dispatch(setStatus('submit-pending'));
|
||||||
|
|
||||||
const { data } = await axiosInstance.put(endPoint, body);
|
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 });
|
trackUsageRef.current('didEditEntry', { trackerProperty });
|
||||||
toggleNotification({
|
toggleNotification({
|
||||||
@ -391,6 +409,9 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin }
|
|||||||
trackUsageRef.current('willUnpublishEntry');
|
trackUsageRef.current('willUnpublishEntry');
|
||||||
|
|
||||||
const { data } = await axiosInstance.post(endPoint);
|
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');
|
trackUsageRef.current('didUnpublishEntry');
|
||||||
toggleNotification({
|
toggleNotification({
|
||||||
|
|||||||
@ -22,6 +22,9 @@ const fetchRelation = async (endPoint, notifyStatus) => {
|
|||||||
const {
|
const {
|
||||||
data: { results, pagination },
|
data: { results, pagination },
|
||||||
} = await axiosInstance.get(endPoint);
|
} = 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();
|
notifyStatus();
|
||||||
|
|
||||||
|
|||||||
@ -79,6 +79,9 @@ const InputUID = ({
|
|||||||
field: name,
|
field: name,
|
||||||
data: modifiedData,
|
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);
|
onChange({ target: { name, value: data, type: 'text' } }, shouldSetInitialValue);
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@ -101,6 +104,9 @@ const InputUID = ({
|
|||||||
field: name,
|
field: name,
|
||||||
value: value ? value.trim() : '',
|
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);
|
setAvailability(data);
|
||||||
|
|
||||||
|
|||||||
@ -106,6 +106,9 @@ const SingleTypeFormWrapper = ({ allLayoutData, children, slug }) => {
|
|||||||
const { data } = await axiosInstance(getRequestUrl(`${slug}${searchToSend}`), {
|
const { data } = await axiosInstance(getRequestUrl(`${slug}${searchToSend}`), {
|
||||||
cancelToken: source.token,
|
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)));
|
dispatch(getDataSucceeded(cleanReceivedData(data)));
|
||||||
|
|
||||||
@ -161,6 +164,9 @@ const SingleTypeFormWrapper = ({ allLayoutData, children, slug }) => {
|
|||||||
trackUsageRef.current('willDeleteEntry', trackerProperty);
|
trackUsageRef.current('willDeleteEntry', trackerProperty);
|
||||||
|
|
||||||
const { data } = await axiosInstance.delete(getRequestUrl(`${slug}${searchToSend}`));
|
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({
|
toggleNotification({
|
||||||
type: 'success',
|
type: 'success',
|
||||||
@ -195,6 +201,9 @@ const SingleTypeFormWrapper = ({ allLayoutData, children, slug }) => {
|
|||||||
dispatch(setStatus('submit-pending'));
|
dispatch(setStatus('submit-pending'));
|
||||||
|
|
||||||
const { data } = await axiosInstance.put(endPoint, body);
|
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);
|
trackUsageRef.current('didCreateEntry', trackerProperty);
|
||||||
toggleNotification({
|
toggleNotification({
|
||||||
@ -243,6 +252,9 @@ const SingleTypeFormWrapper = ({ allLayoutData, children, slug }) => {
|
|||||||
dispatch(setStatus('draft-relation-check-pending'));
|
dispatch(setStatus('draft-relation-check-pending'));
|
||||||
|
|
||||||
const numberOfDraftRelations = await axiosInstance.get(endPoint);
|
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');
|
trackUsageRef.current('didCheckDraftRelations');
|
||||||
|
|
||||||
dispatch(setStatus('resolved'));
|
dispatch(setStatus('resolved'));
|
||||||
@ -264,6 +276,9 @@ const SingleTypeFormWrapper = ({ allLayoutData, children, slug }) => {
|
|||||||
dispatch(setStatus('publish-pending'));
|
dispatch(setStatus('publish-pending'));
|
||||||
|
|
||||||
const { data } = await axiosInstance.post(endPoint);
|
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');
|
trackUsageRef.current('didPublishEntry');
|
||||||
toggleNotification({
|
toggleNotification({
|
||||||
@ -295,6 +310,9 @@ const SingleTypeFormWrapper = ({ allLayoutData, children, slug }) => {
|
|||||||
dispatch(setStatus('submit-pending'));
|
dispatch(setStatus('submit-pending'));
|
||||||
|
|
||||||
const { data } = await axiosInstance.put(endPoint, body);
|
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({
|
toggleNotification({
|
||||||
type: 'success',
|
type: 'success',
|
||||||
@ -334,6 +352,9 @@ const SingleTypeFormWrapper = ({ allLayoutData, children, slug }) => {
|
|||||||
trackUsageRef.current('willUnpublishEntry');
|
trackUsageRef.current('willUnpublishEntry');
|
||||||
|
|
||||||
const { data } = await axiosInstance.post(endPoint);
|
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');
|
trackUsageRef.current('didUnpublishEntry');
|
||||||
toggleNotification({
|
toggleNotification({
|
||||||
|
|||||||
@ -28,6 +28,9 @@ const useFetchContentTypeLayout = (contentTypeUID) => {
|
|||||||
const {
|
const {
|
||||||
data: { data },
|
data: { data },
|
||||||
} = await axiosInstance.get(endPoint, { cancelToken: source.token });
|
} = 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({
|
dispatch({
|
||||||
type: 'GET_DATA_SUCCEEDED',
|
type: 'GET_DATA_SUCCEEDED',
|
||||||
|
|||||||
@ -19,6 +19,9 @@ export const useRelation = (cacheKey, { name, relation, search }) => {
|
|||||||
page: pageParam,
|
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);
|
setCurrentPage(pageParam);
|
||||||
|
|
||||||
@ -37,6 +40,9 @@ export const useRelation = (cacheKey, { name, relation, search }) => {
|
|||||||
page: pageParam,
|
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;
|
return data;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
@ -39,6 +39,9 @@ const useModels = () => {
|
|||||||
axiosInstance.get(getRequestUrl(endPoint), { cancelToken: source.token })
|
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(
|
notifyStatus(
|
||||||
formatMessage({
|
formatMessage({
|
||||||
|
|||||||
@ -8,6 +8,9 @@ const getContentTypeLinks = async (models, userPermissions, toggleNotification)
|
|||||||
const {
|
const {
|
||||||
data: { data: contentTypeConfigurations },
|
data: { data: contentTypeConfigurations },
|
||||||
} = await axiosInstance.get(getRequestUrl('content-types-settings'));
|
} = 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(
|
const { collectionTypesSectionLinks, singleTypesSectionLinks } = generateModelsLinks(
|
||||||
models,
|
models,
|
||||||
|
|||||||
@ -32,6 +32,9 @@ const ComponentSettingsView = () => {
|
|||||||
} = await axiosInstance.get(getRequestUrl(`components/${uid}/configuration`), {
|
} = await axiosInstance.get(getRequestUrl(`components/${uid}/configuration`), {
|
||||||
cancelToken: source.token,
|
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')));
|
dispatch(getDataSucceeded(mergeMetasWithSchema(data, schemas, 'component')));
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
@ -2,6 +2,10 @@ import { axiosInstance } from '../../../../core/utils';
|
|||||||
import { getRequestUrl } from '../../../utils';
|
import { getRequestUrl } from '../../../utils';
|
||||||
|
|
||||||
const putCMSettingsEV = (body, slug, isContentTypeView) => {
|
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(
|
return axiosInstance.put(
|
||||||
getRequestUrl(
|
getRequestUrl(
|
||||||
isContentTypeView ? `content-types/${slug}/configuration` : `components/${slug}/configuration`
|
isContentTypeView ? `content-types/${slug}/configuration` : `components/${slug}/configuration`
|
||||||
|
|||||||
@ -2,6 +2,10 @@ import { axiosInstance } from '../../../../core/utils';
|
|||||||
import { getRequestUrl } from '../../../utils';
|
import { getRequestUrl } from '../../../utils';
|
||||||
|
|
||||||
const putCMSettingsLV = (body, slug) => {
|
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);
|
return axiosInstance.put(getRequestUrl(`content-types/${slug}/configuration`), body);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -113,6 +113,9 @@ function ListView({
|
|||||||
const {
|
const {
|
||||||
data: { results, pagination: paginationResult },
|
data: { results, pagination: paginationResult },
|
||||||
} = await axiosInstance.get(endPoint, opts);
|
} = 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(
|
notifyStatus(
|
||||||
formatMessage(
|
formatMessage(
|
||||||
@ -160,6 +163,9 @@ function ListView({
|
|||||||
const handleConfirmDeleteAllData = useCallback(
|
const handleConfirmDeleteAllData = useCallback(
|
||||||
async (ids) => {
|
async (ids) => {
|
||||||
try {
|
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`), {
|
await axiosInstance.post(getRequestUrl(`collection-types/${slug}/actions/bulkDelete`), {
|
||||||
ids,
|
ids,
|
||||||
});
|
});
|
||||||
@ -181,6 +187,9 @@ function ListView({
|
|||||||
async (idToDelete) => {
|
async (idToDelete) => {
|
||||||
try {
|
try {
|
||||||
await axiosInstance.delete(getRequestUrl(`collection-types/${slug}/${idToDelete}`));
|
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}`);
|
const requestUrl = getRequestUrl(`collection-types/${slug}${params}`);
|
||||||
fetchData(requestUrl);
|
fetchData(requestUrl);
|
||||||
|
|||||||
@ -2,6 +2,9 @@ import { axiosInstance } from '../../../core/utils';
|
|||||||
|
|
||||||
const fetchEnabledPlugins = async () => {
|
const fetchEnabledPlugins = async () => {
|
||||||
const { data } = await axiosInstance.get('/admin/plugins');
|
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;
|
return data;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -14,6 +14,9 @@ const useRegenerate = (id, onRegenerate) => {
|
|||||||
data: { accessKey },
|
data: { accessKey },
|
||||||
},
|
},
|
||||||
} = await axiosInstance.post(`/admin/api-tokens/${id}/regenerate`);
|
} = 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);
|
setIsLoadingConfirmation(false);
|
||||||
onRegenerate(accessKey);
|
onRegenerate(accessKey);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@ -27,6 +27,9 @@ const useRolesList = (shouldFetchData = true) => {
|
|||||||
const {
|
const {
|
||||||
data: { data },
|
data: { data },
|
||||||
} = await axiosInstance.get('/admin/roles');
|
} = 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({
|
dispatch({
|
||||||
type: 'GET_DATA_SUCCEEDED',
|
type: 'GET_DATA_SUCCEEDED',
|
||||||
|
|||||||
@ -34,6 +34,9 @@ const run = async () => {
|
|||||||
data: { isEE, features },
|
data: { isEE, features },
|
||||||
},
|
},
|
||||||
} = await axiosInstance.get('/admin/project-type');
|
} = 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.isEE = isEE;
|
||||||
window.strapi.features = {
|
window.strapi.features = {
|
||||||
|
|||||||
@ -2,6 +2,9 @@ import omit from 'lodash/omit';
|
|||||||
import { axiosInstance } from '../../../core/utils';
|
import { axiosInstance } from '../../../core/utils';
|
||||||
|
|
||||||
const fetchUser = async () => {
|
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');
|
const { data } = await axiosInstance.get('/admin/users/me');
|
||||||
|
|
||||||
return data.data;
|
return data.data;
|
||||||
@ -9,6 +12,9 @@ const fetchUser = async () => {
|
|||||||
|
|
||||||
const putUser = async (body) => {
|
const putUser = async (body) => {
|
||||||
const dataToSend = omit(body, ['confirmPassword', 'currentTheme']);
|
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);
|
const { data } = await axiosInstance.put('/admin/users/me', dataToSend);
|
||||||
|
|
||||||
return { ...data.data, currentTheme: body.currentTheme };
|
return { ...data.data, currentTheme: body.currentTheme };
|
||||||
|
|||||||
@ -68,6 +68,9 @@ const ApiTokenListView = () => {
|
|||||||
const {
|
const {
|
||||||
data: { data },
|
data: { data },
|
||||||
} = await axiosInstance.get(`/admin/api-tokens`);
|
} = 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 });
|
trackUsage('didAccessTokenList', { number: data.length });
|
||||||
|
|
||||||
@ -90,6 +93,9 @@ const ApiTokenListView = () => {
|
|||||||
|
|
||||||
const deleteMutation = useMutation(
|
const deleteMutation = useMutation(
|
||||||
async (id) => {
|
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}`);
|
await axiosInstance.delete(`/admin/api-tokens/${id}`);
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@ -3,12 +3,18 @@ import prefixAllUrls from './prefixAllUrls';
|
|||||||
|
|
||||||
const fetchProjectSettings = async () => {
|
const fetchProjectSettings = async () => {
|
||||||
const { data } = await axiosInstance.get('/admin/project-settings');
|
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);
|
return prefixAllUrls(data);
|
||||||
};
|
};
|
||||||
|
|
||||||
const postProjectSettings = async (body) => {
|
const postProjectSettings = async (body) => {
|
||||||
const { data } = await axiosInstance.post('/admin/project-settings', 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);
|
return prefixAllUrls(data);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -2,12 +2,18 @@ import { axiosInstance } from '../../../../../../core/utils';
|
|||||||
|
|
||||||
const fetchUser = async (id) => {
|
const fetchUser = async (id) => {
|
||||||
const { data } = await axiosInstance.get(`/admin/users/${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;
|
return data.data;
|
||||||
};
|
};
|
||||||
|
|
||||||
const putUser = async (id, body) => {
|
const putUser = async (id, body) => {
|
||||||
const { data } = await axiosInstance.put(`/admin/users/${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;
|
return data.data;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -34,27 +34,36 @@ const ModalForm = ({ queryName, onToggle }) => {
|
|||||||
const { formatMessage } = useIntl();
|
const { formatMessage } = useIntl();
|
||||||
const toggleNotification = useNotification();
|
const toggleNotification = useNotification();
|
||||||
const { lockApp, unlockApp } = useOverlayBlocker();
|
const { lockApp, unlockApp } = useOverlayBlocker();
|
||||||
const postMutation = useMutation((body) => axiosInstance.post('/admin/users', body), {
|
const postMutation = useMutation(
|
||||||
async onSuccess({ data }) {
|
(body) => {
|
||||||
setRegistrationToken(data.data.registrationToken);
|
console.warn(
|
||||||
await queryClient.invalidateQueries(queryName);
|
'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'
|
||||||
goNext();
|
);
|
||||||
setIsSubmitting(false);
|
|
||||||
},
|
|
||||||
onError(err) {
|
|
||||||
setIsSubmitting(false);
|
|
||||||
|
|
||||||
toggleNotification({
|
return axiosInstance.post('/admin/users', body);
|
||||||
type: 'warning',
|
},
|
||||||
message: { id: 'notification.error', defaultMessage: 'An error occured' },
|
{
|
||||||
});
|
async onSuccess({ data }) {
|
||||||
|
setRegistrationToken(data.data.registrationToken);
|
||||||
|
await queryClient.invalidateQueries(queryName);
|
||||||
|
goNext();
|
||||||
|
setIsSubmitting(false);
|
||||||
|
},
|
||||||
|
onError(err) {
|
||||||
|
setIsSubmitting(false);
|
||||||
|
|
||||||
throw err;
|
toggleNotification({
|
||||||
},
|
type: 'warning',
|
||||||
onSettled() {
|
message: { id: 'notification.error', defaultMessage: 'An error occured' },
|
||||||
unlockApp();
|
});
|
||||||
},
|
|
||||||
});
|
throw err;
|
||||||
|
},
|
||||||
|
onSettled() {
|
||||||
|
unlockApp();
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
const headerTitle = formatMessage({
|
const headerTitle = formatMessage({
|
||||||
id: 'Settings.permissions.users.create',
|
id: 'Settings.permissions.users.create',
|
||||||
|
|||||||
@ -4,6 +4,9 @@ const fetchData = async (search, notify) => {
|
|||||||
const {
|
const {
|
||||||
data: { data },
|
data: { data },
|
||||||
} = await axiosInstance.get(`/admin/users${search}`);
|
} = 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();
|
notify();
|
||||||
|
|
||||||
@ -11,6 +14,10 @@ const fetchData = async (search, notify) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const deleteData = async (ids) => {
|
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 });
|
await axiosInstance.post('/admin/users/batch-delete', { ids });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -28,6 +28,9 @@ const Loader = () => (
|
|||||||
|
|
||||||
const fetchData = async () => {
|
const fetchData = async () => {
|
||||||
const { data } = await axiosInstance.get('/admin/roles');
|
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;
|
return data.data;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -64,7 +64,13 @@ const EditView = () => {
|
|||||||
data: triggerResponse,
|
data: triggerResponse,
|
||||||
isIdle: isTriggerIdle,
|
isIdle: isTriggerIdle,
|
||||||
mutate,
|
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 = () =>
|
const triggerWebhook = () =>
|
||||||
mutate(null, {
|
mutate(null, {
|
||||||
|
|||||||
@ -78,6 +78,9 @@ const useRoleActions = ({ getData, canCreate, canDelete, canUpdate }) => {
|
|||||||
type: 'ON_REMOVE_ROLES',
|
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', {
|
await axiosInstance.post('/admin/roles/batch-delete', {
|
||||||
ids: [roleToDelete],
|
ids: [roleToDelete],
|
||||||
});
|
});
|
||||||
|
|||||||
@ -108,6 +108,10 @@ const DataManagerProvider = ({
|
|||||||
{ data: reservedNames },
|
{ data: reservedNames },
|
||||||
] = await Promise.all(
|
] = await Promise.all(
|
||||||
['components', 'content-types', 'reserved-names'].map((endPoint) => {
|
['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);
|
return axiosInstance.get(endPoint);
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
@ -315,7 +319,9 @@ const DataManagerProvider = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
lockAppWithAutoreload();
|
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);
|
await axiosInstance.delete(requestURL);
|
||||||
|
|
||||||
// Make sure the server has restarted
|
// Make sure the server has restarted
|
||||||
@ -349,6 +355,9 @@ const DataManagerProvider = ({
|
|||||||
lockAppWithAutoreload();
|
lockAppWithAutoreload();
|
||||||
|
|
||||||
// Update the category
|
// 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 });
|
await axiosInstance({ url: requestURL, method: 'PUT', data: body });
|
||||||
|
|
||||||
// Make sure the server has restarted
|
// Make sure the server has restarted
|
||||||
@ -507,6 +516,10 @@ const DataManagerProvider = ({
|
|||||||
// Lock the app
|
// Lock the app
|
||||||
lockAppWithAutoreload();
|
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({
|
await axiosInstance({
|
||||||
url: requestURL,
|
url: requestURL,
|
||||||
method,
|
method,
|
||||||
|
|||||||
@ -1,12 +1,18 @@
|
|||||||
import axiosInstance from '../../../utils/axiosInstance';
|
import axiosInstance from '../../../utils/axiosInstance';
|
||||||
|
|
||||||
const fetchEmailSettings = async () => {
|
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');
|
const { data } = await axiosInstance.get('/email/settings');
|
||||||
|
|
||||||
return data.config;
|
return data.config;
|
||||||
};
|
};
|
||||||
|
|
||||||
const postEmailTest = async (body) => {
|
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);
|
await axiosInstance.post('/email/test', body);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -47,6 +47,9 @@ export const useAssets = ({ skipWhen = false, query = {} } = {}) => {
|
|||||||
addQueryPrefix: true,
|
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(
|
notifyStatus(
|
||||||
formatMessage({
|
formatMessage({
|
||||||
|
|||||||
@ -22,6 +22,9 @@ export const useBulkMove = () => {
|
|||||||
|
|
||||||
return acc;
|
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 });
|
return axiosInstance.post(url, { ...payload, destinationFolderId });
|
||||||
};
|
};
|
||||||
|
|||||||
@ -22,6 +22,9 @@ export const useBulkRemove = () => {
|
|||||||
|
|
||||||
return acc;
|
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);
|
return axiosInstance.post(url, payload);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -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({
|
return axiosInstance({
|
||||||
method: 'post',
|
method: 'post',
|
||||||
url: endpoint,
|
url: endpoint,
|
||||||
|
|||||||
@ -8,6 +8,10 @@ const editFolderRequest = ({ attrs, id }) => {
|
|||||||
const method = isEditing ? 'put' : 'post';
|
const method = isEditing ? 'put' : 'post';
|
||||||
const url = getRequestUrl(`folders/${id ?? ''}`);
|
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);
|
return axiosInstance[method](url, attrs).then((res) => res.data);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -13,6 +13,9 @@ export const useFolder = (id, { enabled = true }) => {
|
|||||||
const { data } = await axiosInstance.get(
|
const { data } = await axiosInstance.get(
|
||||||
`${dataRequestURL}/${id}?populate[parent][populate][parent]=*`
|
`${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;
|
return data.data;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
@ -18,6 +18,9 @@ export const useFolderStructure = ({ enabled = true } = {}) => {
|
|||||||
const {
|
const {
|
||||||
data: { data },
|
data: { data },
|
||||||
} = await axiosInstance.get(dataRequestURL);
|
} = 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));
|
const children = data.map((f) => recursiveRenameKeys(f, (key) => FIELD_MAPPING?.[key] ?? key));
|
||||||
|
|
||||||
|
|||||||
@ -50,6 +50,9 @@ export const useFolders = ({ enabled = true, query = {} }) => {
|
|||||||
const { data } = await axiosInstance.get(
|
const { data } = await axiosInstance.get(
|
||||||
`${dataRequestURL}?${stringify(params, { encode: false })}`
|
`${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(
|
notifyStatus(
|
||||||
formatMessage({
|
formatMessage({
|
||||||
|
|||||||
@ -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({
|
return axiosInstance({
|
||||||
method: 'post',
|
method: 'post',
|
||||||
url: endpoint,
|
url: endpoint,
|
||||||
|
|||||||
@ -50,6 +50,9 @@ export const SettingsPage = () => {
|
|||||||
} = await axiosInstance.get(getRequestUrl('settings'), {
|
} = await axiosInstance.get(getRequestUrl('settings'), {
|
||||||
cancelToken: source.token,
|
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({
|
dispatch({
|
||||||
type: 'GET_DATA_SUCCEEDED',
|
type: 'GET_DATA_SUCCEEDED',
|
||||||
@ -86,6 +89,9 @@ export const SettingsPage = () => {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
await axiosInstance.put(getRequestUrl('settings'), modifiedData);
|
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({
|
dispatch({
|
||||||
type: 'SUBMIT_SUCCEEDED',
|
type: 'SUBMIT_SUCCEEDED',
|
||||||
|
|||||||
@ -4,5 +4,9 @@ import getRequestUrl from './getRequestUrl';
|
|||||||
export const deleteRequest = (type, id) => {
|
export const deleteRequest = (type, id) => {
|
||||||
const url = getRequestUrl(`/${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);
|
return axiosInstance.delete(url);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -62,6 +62,9 @@ const Content = ({ appLocales, currentLocale, localizations, readPermissions })
|
|||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
try {
|
try {
|
||||||
const { data: response } = await axiosInstance.get(requestURL);
|
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);
|
const cleanedData = cleanData(response, allLayoutData, localizations);
|
||||||
['createdBy', 'updatedBy', 'publishedAt', 'id', 'createdAt'].forEach((key) => {
|
['createdBy', 'updatedBy', 'publishedAt', 'id', 'createdAt'].forEach((key) => {
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { useCallback, useReducer, useEffect, useRef } from 'react';
|
import { useCallback, useReducer, useEffect, useRef } from 'react';
|
||||||
import { useNotification } from '@strapi/helper-plugin';
|
import { useNotification } from '@strapi/helper-plugin';
|
||||||
import reducer, { initialState } from './reducer';
|
import reducer, { initialState } from './reducer';
|
||||||
import axiosIntance from '../../utils/axiosInstance';
|
import axiosInstance from '../../utils/axiosInstance';
|
||||||
import pluginId from '../../pluginId';
|
import pluginId from '../../pluginId';
|
||||||
|
|
||||||
const useFetchRole = (id) => {
|
const useFetchRole = (id) => {
|
||||||
@ -29,7 +29,10 @@ const useFetchRole = (id) => {
|
|||||||
try {
|
try {
|
||||||
const {
|
const {
|
||||||
data: { role },
|
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
|
// Prevent updating state on an unmounted component
|
||||||
if (isMounted.current) {
|
if (isMounted.current) {
|
||||||
|
|||||||
@ -22,6 +22,9 @@ const usePlugins = (shouldFetchData = true) => {
|
|||||||
const [{ permissions }, { routes }] = await Promise.all(
|
const [{ permissions }, { routes }] = await Promise.all(
|
||||||
[`/${pluginId}/permissions`, `/${pluginId}/routes`].map(async (endpoint) => {
|
[`/${pluginId}/permissions`, `/${pluginId}/routes`].map(async (endpoint) => {
|
||||||
const res = await axiosInstance.get(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;
|
return res.data;
|
||||||
})
|
})
|
||||||
|
|||||||
@ -1,12 +1,19 @@
|
|||||||
import { axiosInstance, getRequestURL } from '../../../utils';
|
import { axiosInstance, getRequestURL } from '../../../utils';
|
||||||
|
|
||||||
const fetchData = async () => {
|
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'));
|
const { data } = await axiosInstance.get(getRequestURL('advanced'));
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
};
|
};
|
||||||
|
|
||||||
const putAdvancedSettings = (body) => {
|
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);
|
return axiosInstance.put(getRequestURL('advanced'), body);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -2,11 +2,18 @@ import { axiosInstance, getRequestURL } from '../../../utils';
|
|||||||
|
|
||||||
const fetchData = async () => {
|
const fetchData = async () => {
|
||||||
const { data } = await axiosInstance.get(getRequestURL('email-templates'));
|
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;
|
return data;
|
||||||
};
|
};
|
||||||
|
|
||||||
const putEmailTemplate = (body) => {
|
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);
|
return axiosInstance.put(getRequestURL('email-templates'), body);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -4,6 +4,9 @@ import { getRequestURL, axiosInstance } from '../../../utils';
|
|||||||
export const fetchData = async (toggleNotification) => {
|
export const fetchData = async (toggleNotification) => {
|
||||||
try {
|
try {
|
||||||
const { data } = await axiosInstance.get(getRequestURL('providers'));
|
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;
|
return data;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@ -17,5 +20,9 @@ export const fetchData = async (toggleNotification) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const putProvider = (body) => {
|
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);
|
return axiosInstance.put(getRequestURL('providers'), body);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -44,6 +44,9 @@ const EditPage = () => {
|
|||||||
const permissions = permissionsRef.current.getPermissions();
|
const permissions = permissionsRef.current.getPermissions();
|
||||||
// Update role in Strapi
|
// Update role in Strapi
|
||||||
await axiosInstance.post(`/${pluginId}/roles`, { ...data, ...permissions, users: [] });
|
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
|
// Notify success
|
||||||
trackUsage('didCreateRole');
|
trackUsage('didCreateRole');
|
||||||
toggleNotification({
|
toggleNotification({
|
||||||
|
|||||||
@ -48,6 +48,9 @@ const EditPage = () => {
|
|||||||
const permissions = permissionsRef.current.getPermissions();
|
const permissions = permissionsRef.current.getPermissions();
|
||||||
// Update role in Strapi
|
// Update role in Strapi
|
||||||
await axiosInstance.put(`/${pluginId}/roles/${id}`, { ...data, ...permissions, users: [] });
|
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
|
// Notify success
|
||||||
onSubmitSucceeded({ name: data.name, description: data.description });
|
onSubmitSucceeded({ name: data.name, description: data.description });
|
||||||
toggleNotification({
|
toggleNotification({
|
||||||
|
|||||||
@ -3,6 +3,9 @@ import { getRequestURL, axiosInstance } from '../../../../utils';
|
|||||||
export const fetchData = async (toggleNotification, notifyStatus) => {
|
export const fetchData = async (toggleNotification, notifyStatus) => {
|
||||||
try {
|
try {
|
||||||
const { data } = await axiosInstance.get(getRequestURL('roles'));
|
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');
|
notifyStatus('The roles have loaded successfully');
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
@ -19,6 +22,9 @@ export const fetchData = async (toggleNotification, notifyStatus) => {
|
|||||||
export const deleteData = async (id, toggleNotification) => {
|
export const deleteData = async (id, toggleNotification) => {
|
||||||
try {
|
try {
|
||||||
await axiosInstance.delete(`${getRequestURL('roles')}/${id}`);
|
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) {
|
} catch (error) {
|
||||||
toggleNotification({
|
toggleNotification({
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user