Skip to content

Commit

Permalink
navigate to correct places on delete and duplicate. Added Copy after …
Browse files Browse the repository at this point in the history
…title on duplication
  • Loading branch information
MaggieCabrera committed Jun 5, 2023
1 parent 45df4ab commit b71de84
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export default function SidebarNavigationScreenNavigationMenu() {

const postType = `wp_navigation`;
const {
goTo,
params: { postId },
} = useNavigator();

Expand All @@ -76,19 +77,19 @@ export default function SidebarNavigationScreenNavigationMenu() {
createSuccessNotice( 'Deleted Navigation menu', {
type: 'snackbar',
} );
//TODO: navigate to previous menu
goTo( '/navigation' );
};
const handleDuplicate = async () => {
const savedRecord = await saveEntityRecord( 'postType', postType, {
title: menuTitle,
title: menuTitle + __( ' (Copy)' ),
content: navigationMenu?.content?.raw,
status: 'publish',
} );
if ( savedRecord ) {
createSuccessNotice( 'Duplicated Navigation menu', {
type: 'snackbar',
} );
//TODO: navigate to the duplicated menu
goTo( `/navigation/${ postType }/${ savedRecord.id }` );
}
};

Expand Down

0 comments on commit b71de84

Please sign in to comment.