Skip to content

Commit

Permalink
open edit page after model creation
Browse files Browse the repository at this point in the history
  • Loading branch information
vabene1111 committed Dec 28, 2024
1 parent ebfe5ee commit 882f18a
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion vue3/src/pages/ModelEditPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</v-row>
<v-row>
<v-col>
<component :is="editorComponent" :item-id="id" @delete="router.go(-1)"></component>
<component :is="editorComponent" :item-id="id" @delete="router.go(-1)" @create="(obj: any) => objectCreated(obj)"></component>
</v-col>
</v-row>
</v-container>
Expand All @@ -35,6 +35,16 @@ const editorComponent = shallowRef(defineAsyncComponent(() => import(`@/componen
const router = useRouter()
/**
* after creation open object with correct URL in edit mode
* @param obj obj that was created
*/
function objectCreated(obj: any) {
if (obj.id) {
router.push({name: 'ModelEditPage', params: {model: props.model, id: obj.id}})
}
}
</script>

<style scoped>
Expand Down

0 comments on commit 882f18a

Please sign in to comment.