diff --git a/vue3/src/pages/PropertyEditorPage.vue b/vue3/src/pages/PropertyEditorPage.vue
index 744a0fc62..ddecb7654 100644
--- a/vue3/src/pages/PropertyEditorPage.vue
+++ b/vue3/src/pages/PropertyEditorPage.vue
@@ -64,7 +64,7 @@
+ :loading="food.loading" @click:clear="deleteFoodProperty(p, food)" clearable>
@@ -263,6 +263,28 @@ function buildFoodProperties(food: Food) {
return food
}
+/**
+ * deletes the given property either on client or also on server if it has an id
+ * @param p
+ * @param food
+ */
+function deleteFoodProperty(p: Property, food: Food & { loading?: boolean } ){
+ let api = new ApiApi()
+
+ if(p.id){
+ food.loading = true
+ api.apiPropertyDestroy({id: p.id}).then(r => {
+ p.propertyAmount = null
+ }).catch(err => {
+ useMessageStore().addError(ErrorMessageType.DELETE_ERROR, err)
+ }).finally(() => {
+ food.loading = false
+ })
+ } else {
+ p.propertyAmount = null
+ }
+}
+
/**
* update food
* @param food
|