Reset edits on successful save as copy

Fixes #979
This commit is contained in:
rijkvanzanten
2020-11-13 12:10:30 -05:00
parent ec9ce55720
commit ea71f58fd8
2 changed files with 5 additions and 2 deletions

View File

@@ -143,10 +143,13 @@ export function useItem(collection: Ref<string>, primaryKey: Ref<string | number
const response = await api.post(endpoint.value, newItem);
notify({
title: i18n.t('item_create_success'),
title: i18n.tc('item_create_success', 1),
type: 'success',
});
// Reset edits to the current item
edits.value = {};
return primaryKeyField.value ? response.data.data[primaryKeyField.value.field] : null;
} catch (err) {
if (err?.response?.data?.errors) {

View File

@@ -66,7 +66,7 @@ export default defineComponent({
},
type: {
type: String,
validator: (val: string) => ['text', 'string'].includes(val),
validator: (val: string) => ['text', 'string', 'json', 'csv'].includes(val),
},
},
setup(props) {