Add link in navigation when duplicating screens
This commit is contained in:
parent
868989d4c6
commit
c726dfbedb
|
@ -1,5 +1,5 @@
|
||||||
<script>
|
<script>
|
||||||
import { screenStore, componentStore } from "stores/builder"
|
import { screenStore, componentStore, navigationStore } from "stores/builder"
|
||||||
import ConfirmDialog from "components/common/ConfirmDialog.svelte"
|
import ConfirmDialog from "components/common/ConfirmDialog.svelte"
|
||||||
import {
|
import {
|
||||||
ActionMenu,
|
ActionMenu,
|
||||||
|
@ -12,6 +12,7 @@
|
||||||
import ScreenDetailsModal from "components/design/ScreenDetailsModal.svelte"
|
import ScreenDetailsModal from "components/design/ScreenDetailsModal.svelte"
|
||||||
import sanitizeUrl from "helpers/sanitizeUrl"
|
import sanitizeUrl from "helpers/sanitizeUrl"
|
||||||
import { makeComponentUnique } from "helpers/components"
|
import { makeComponentUnique } from "helpers/components"
|
||||||
|
import { capitalise } from "helpers"
|
||||||
|
|
||||||
export let screenId
|
export let screenId
|
||||||
|
|
||||||
|
@ -48,6 +49,13 @@
|
||||||
try {
|
try {
|
||||||
// Create the screen
|
// Create the screen
|
||||||
await screenStore.save(duplicateScreen)
|
await screenStore.save(duplicateScreen)
|
||||||
|
|
||||||
|
// Add new screen to navigation
|
||||||
|
await navigationStore.saveLink(
|
||||||
|
duplicateScreen.routing.route,
|
||||||
|
capitalise(duplicateScreen.routing.route.split("/")[1]),
|
||||||
|
duplicateScreen.routing.roleId
|
||||||
|
)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
notifications.error("Error duplicating screen")
|
notifications.error("Error duplicating screen")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue