Skip to content

Commit

Permalink
Add TRASH_POST_FAILURE effect for dispatching trash error message
Browse files Browse the repository at this point in the history
  • Loading branch information
westonruter committed Jul 13, 2017
1 parent 069975c commit b05129a
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions editor/effects.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,6 @@ export default {
message: __( 'An unknown error occurred.' ),
} ),
} );
let message;
if ( err.responseJSON && err.responseJSON.message ) {
message = err.responseJSON.message;
} else {
message = __( 'Trashing failed' );
}
dispatch( errorNotice( message ) );
}
);
},
Expand All @@ -166,6 +159,10 @@ export default {
ids: postId,
} );
},
TRASH_POST_FAILURE( action, store ) {
const message = action.error.message && action.error.code !== 'unknown_error' ? action.error.message : __( 'Trashing failed' );
store.dispatch( errorNotice( message ) );
},
MERGE_BLOCKS( action, store ) {
const { dispatch } = store;
const [ blockA, blockB ] = action.blocks;
Expand Down

0 comments on commit b05129a

Please sign in to comment.