mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-06 22:58:19 -05:00
open edit page after model creation
This commit is contained in:
@@ -11,7 +11,7 @@
|
|||||||
</v-row>
|
</v-row>
|
||||||
<v-row>
|
<v-row>
|
||||||
<v-col>
|
<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-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
</v-container>
|
</v-container>
|
||||||
@@ -35,6 +35,16 @@ const editorComponent = shallowRef(defineAsyncComponent(() => import(`@/componen
|
|||||||
|
|
||||||
const router = useRouter()
|
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>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|||||||
Reference in New Issue
Block a user