Merge pull request #3290 from strapi/fix/error-track

Fix missing history in saga
This commit is contained in:
Jim LAURIE 2019-05-20 11:17:08 +02:00 committed by GitHub
commit 0997ca0801
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View File

@ -71,7 +71,7 @@ export function* submitCT({
oldContentTypeName, oldContentTypeName,
body, body,
source, source,
context: { emitEvent, plugins, router, updatePlugin }, context: { emitEvent, plugins, history, updatePlugin },
}) { }) {
try { try {
const requestURL = `/${pluginId}/models/${oldContentTypeName}`; const requestURL = `/${pluginId}/models/${oldContentTypeName}`;
@ -88,7 +88,7 @@ export function* submitCT({
yield call(request, requestURL, opts, true); yield call(request, requestURL, opts, true);
emitEvent('didSaveContentType'); emitEvent('didSaveContentType');
yield put(submitContentTypeSucceeded()); yield put(submitContentTypeSucceeded());
router.history.push(`/plugins/${pluginId}/models/${name}`); history.push(`/plugins/${pluginId}/models/${name}`);
if (name !== oldContentTypeName) { if (name !== oldContentTypeName) {
emitEvent('didEditNameOfContentType'); emitEvent('didEditNameOfContentType');

View File

@ -207,7 +207,9 @@ export class ModelPage extends React.Component {
submitContentType( submitContentType(
this.getModelName(), this.getModelName(),
get(modifiedData, this.getModelName()), get(modifiedData, this.getModelName()),
this.context, Object.assign(this.context, {
history: this.props.history,
}),
this.getSource(), this.getSource(),
); );
}; };