fix(admin): support new axios wrapper format

fix(content-type-builder): support new axios wrapper format
This commit is contained in:
Jamie Howard 2022-12-08 15:39:30 +00:00
parent dadcc9a2b5
commit b08987ae80
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);