Merge pull request #15131 from strapi/fix/support-axios-wrapper

FIX: Support new axios wrapper format
This commit is contained in:
Gustav Hansen 2022-12-08 17:33:53 +01:00 committed by GitHub
commit 11d5cebea6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 10 deletions

View File

@ -103,7 +103,7 @@ const SingleTypeFormWrapper = ({ allLayoutData, children, slug }) => {
setIsCreatingEntry(true);
try {
const { data } = await axiosInstance(getRequestUrl(`${slug}${searchToSend}`), {
const { data } = await axiosInstance.get(getRequestUrl(`${slug}${searchToSend}`), {
cancelToken: source.token,
});

View File

@ -351,7 +351,7 @@ const DataManagerProvider = ({
// Update the category
// TODO: remember to pass also the pluginId when you use the new get, post, put, delete methods from getFetchClient
await axiosInstance({ url: requestURL, method: 'PUT', data: body });
await axiosInstance.put(requestURL, body);
// Make sure the server has restarted
await serverRestartWatcher(true);
@ -501,19 +501,18 @@ const DataManagerProvider = ({
trackUsage('willSaveComponent');
}
const method = isCreating ? 'POST' : 'PUT';
// Lock the app
lockAppWithAutoreload();
const baseURL = `/${endPoint}`;
const requestURL = isCreating ? baseURL : `${baseURL}/${currentUid}`;
// Lock the app
lockAppWithAutoreload();
// TODO: remember to pass also the pluginId when you use the new get, post, put, delete methods from getFetchClient
await axiosInstance({
url: requestURL,
method,
data: body,
});
if (isCreating) {
await axiosInstance.post(requestURL, body);
} else {
await axiosInstance.put(requestURL, body);
}
// Make sure the server has restarted
await serverRestartWatcher(true);