|
Lines 14-20
Link Here
|
| 14 |
:componentPropData="{ ...$props, ...$data, resourceForm }" |
14 |
:componentPropData="{ ...$props, ...$data, resourceForm }" |
| 15 |
/> |
15 |
/> |
| 16 |
<form |
16 |
<form |
| 17 |
@submit="instancedResource.onFormSave($event, resourceToSave)" |
17 |
@submit="saveAndNavigate($event, resourceToSave)" |
| 18 |
ref="resourceForm" |
18 |
ref="resourceForm" |
| 19 |
> |
19 |
> |
| 20 |
<TabsWrapper |
20 |
<TabsWrapper |
|
Lines 154-164
export default {
Link Here
|
| 154 |
initialized.value = true; |
154 |
initialized.value = true; |
| 155 |
} |
155 |
} |
| 156 |
}); |
156 |
}); |
|
|
157 |
|
| 158 |
const saveAndNavigate = ($event, resourceToSave) => { |
| 159 |
const { components, navigationOnFormSave, onFormSave, router, idAttr } = props.instancedResource |
| 160 |
// Default to show |
| 161 |
const navigationAction = navigationOnFormSave || components.show |
| 162 |
const idParamRequired = navigationAction === components.show || navigationAction === components.edit |
| 163 |
onFormSave($event, resourceToSave).then(resource => { |
| 164 |
if(resource) { |
| 165 |
router.push({ |
| 166 |
name: navigationAction, |
| 167 |
...(idParamRequired && { |
| 168 |
params: { |
| 169 |
[idAttr]: resource[idAttr] |
| 170 |
} |
| 171 |
}) |
| 172 |
}) |
| 173 |
} |
| 174 |
}) |
| 175 |
} |
| 157 |
return { |
176 |
return { |
| 158 |
initialized, |
177 |
initialized, |
| 159 |
resource, |
178 |
resource, |
| 160 |
resourceToSave, |
179 |
resourceToSave, |
| 161 |
resourceForm, |
180 |
resourceForm, |
|
|
181 |
saveAndNavigate |
| 162 |
}; |
182 |
}; |
| 163 |
}, |
183 |
}, |
| 164 |
props: { |
184 |
props: { |