Merge pull request #8734 from strapi/rf/bug-fix

Fix small bugs related to RF migration
This commit is contained in:
ELABBASSI Hicham 2020-11-25 09:45:33 +01:00 committed by GitHub
commit 8d9eee1cb3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 9 deletions

View File

@ -44,7 +44,7 @@ const DynamicComponent = ({ componentUid, friendlyName, icon, setIsOverDynamicZo
isOver={isOver}
onClick={() => {
if (!isLoading && canAccess) {
push(`/plugins/${pluginId}/ctm-configurations/edit-settings/components/${componentUid}/`);
push(`/plugins/${pluginId}/components/${componentUid}/configurations/edit`);
}
}}
onMouseEvent={handleMouseEvent}

View File

@ -205,7 +205,10 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, from, slug }) => {
const response = await request(endPoint, { method: 'POST', body });
emitEventRef.current('didCreateEntry', trackerProperty);
strapi.notification.success(getTrad('success.record.save'));
strapi.notification.toggle({
type: 'success',
message: { id: getTrad('success.record.save') },
});
dispatch({ type: 'SUBMIT_SUCCEEDED', data: cleanReceivedData(response) });
// Enable navigation and remove loaders
@ -235,7 +238,10 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, from, slug }) => {
dispatch({ type: 'SUBMIT_SUCCEEDED', data: cleanReceivedData(data) });
dispatch({ type: 'SET_STATUS', status: 'resolved' });
strapi.notification.success(getTrad('success.record.publish'));
strapi.notification.toggle({
type: 'success',
message: { id: getTrad('success.record.publish') },
});
} catch (err) {
displayErrors(err);
dispatch({ type: 'SET_STATUS', status: 'resolved' });
@ -254,6 +260,10 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, from, slug }) => {
const response = await request(endPoint, { method: 'PUT', body });
emitEventRef.current('didEditEntry', { trackerProperty });
strapi.notification.toggle({
type: 'success',
message: { id: getTrad('success.record.save') },
});
dispatch({ type: 'SUBMIT_SUCCEEDED', data: cleanReceivedData(response) });
dispatch({ type: 'SET_STATUS', status: 'resolved' });

View File

@ -24,8 +24,6 @@ const SingleTypeFormWrapper = ({ allLayoutData, children, from, slug }) => {
dispatch,
] = useReducer(crudReducer, crudInitialState);
const id = get(data, 'id', '');
const cleanReceivedData = useCallback(
data => {
const cleaned = removePasswordFieldsFromData(
@ -136,7 +134,7 @@ const SingleTypeFormWrapper = ({ allLayoutData, children, from, slug }) => {
try {
emitEventRef.current('willDeleteEntry', trackerProperty);
const response = await request(getRequestUrl(`${slug}/${id}`), {
const response = await request(getRequestUrl(`${slug}`), {
method: 'DELETE',
});
@ -151,7 +149,7 @@ const SingleTypeFormWrapper = ({ allLayoutData, children, from, slug }) => {
return Promise.reject(err);
}
},
[id, slug]
[slug]
);
const onDeleteSucceeded = useCallback(() => {
@ -170,7 +168,10 @@ const SingleTypeFormWrapper = ({ allLayoutData, children, from, slug }) => {
const response = await request(endPoint, { method: 'PUT', body });
emitEventRef.current('didCreateEntry', trackerProperty);
strapi.notification.success(getTrad('success.record.save'));
strapi.notification.toggle({
type: 'success',
message: { id: getTrad('success.record.save') },
});
dispatch({ type: 'SUBMIT_SUCCEEDED', data: cleanReceivedData(response) });
setIsCreatingEntry(false);
@ -194,7 +195,10 @@ const SingleTypeFormWrapper = ({ allLayoutData, children, from, slug }) => {
const data = await request(endPoint, { method: 'POST' });
emitEventRef.current('didPublishEntry');
strapi.notification.success(getTrad('success.record.publish'));
strapi.notification.toggle({
type: 'success',
message: { id: getTrad('success.record.publish') },
});
dispatch({ type: 'SUBMIT_SUCCEEDED', data: cleanReceivedData(data) });
dispatch({ type: 'SET_STATUS', status: 'resolved' });
@ -215,6 +219,11 @@ const SingleTypeFormWrapper = ({ allLayoutData, children, from, slug }) => {
const response = await request(endPoint, { method: 'PUT', body });
strapi.notification.toggle({
type: 'success',
message: { id: getTrad('success.record.save') },
});
emitEventRef.current('didEditEntry', { trackerProperty });
dispatch({ type: 'SUBMIT_SUCCEEDED', data: cleanReceivedData(response) });