improvement(backends): changes for registerBackend compatibility (#1880)

This commit is contained in:
Tony Alves 2018-11-26 13:30:50 -08:00 committed by Shawn Erquhart
parent 751ec091fb
commit da91038067
3 changed files with 4 additions and 4 deletions

View File

@ -6,7 +6,7 @@ import { currentBackend } from 'src/backend';
import { getAsset } from 'Reducers';
import { selectFields } from 'Reducers/collections';
import { EDITORIAL_WORKFLOW } from 'Constants/publishModes';
import { EditorialWorkflowError } from 'netlify-cms-lib-util';
import { EDITORIAL_WORKFLOW_ERROR } from 'netlify-cms-lib-util';
import { loadEntry } from './entries';
import ValidationErrorTypes from 'Constants/validationErrorTypes';
@ -238,7 +238,7 @@ export function loadUnpublishedEntry(collection, slug) {
.unpublishedEntry(collection, slug)
.then(entry => dispatch(unpublishedEntryLoaded(collection, entry)))
.catch(error => {
if (error instanceof EditorialWorkflowError && error.notUnderEditorialWorkflow) {
if (error.name === EDITORIAL_WORKFLOW_ERROR && error.notUnderEditorialWorkflow) {
dispatch(unpublishedEntryRedirected(collection, slug));
dispatch(loadEntry(collection, slug));
} else {

View File

@ -449,7 +449,7 @@ class Backend {
}
const commitMessage = commitMessageFormatter('delete', config, { collection, slug, path });
return this.implementation.deleteFile(path, commitMessage);
return this.implementation.deleteFile(path, commitMessage, { collection, slug });
}
deleteMedia(config, path) {

View File

@ -1,6 +1,6 @@
export APIError from './APIError';
export Cursor, { CURSOR_COMPATIBILITY_SYMBOL } from './Cursor';
export EditorialWorkflowError from './EditorialWorkflowError';
export EditorialWorkflowError, { EDITORIAL_WORKFLOW_ERROR } from './EditorialWorkflowError';
export localForage from './localForage';
export { resolvePath, basename, fileExtensionWithSeparator, fileExtension } from './path';
export { filterPromises, resolvePromiseProperties, then } from './promise';