Added missing functionality.
This commit is contained in:
1 parent
d613f8c1d7
commit
c53d842c34
4 files changed
+83
-28
No files matched your search
@@ -1,5 +1,5 @@
|
||||
import {defineStore} from "pinia";
|
||||
import type {Article} from "~/types/article";
|
||||
import {Article} from "~/types/article";
|
||||
import {NotificationMessage} from "~/types/notificationMessage";
|
||||
import type {RuntimeConfig} from "nuxt/schema";
|
||||
import {Origin} from "~/types/origin";
|
||||
@@ -489,17 +489,22 @@ export const useLabelEditorStore = defineStore('label_editor_store', {
|
||||
}
|
||||
},
|
||||
|
||||
async deleteNutrition(nutrition: Nutrition): Promise<Nutrition | null> {
|
||||
try {
|
||||
await $fetch(this.config.public.url + '/nutrition/' + nutrition.id, {
|
||||
method: 'DELETE',
|
||||
});
|
||||
async deleteArticleNutrition(nutrition: Nutrition): Promise<Nutrition | null> {
|
||||
if (this.article != null) {
|
||||
try {
|
||||
await $fetch(this.config.public.url + '/article/' + this.article.id + '/nutrition', {
|
||||
method: 'DELETE',
|
||||
});
|
||||
|
||||
this.addNotification(false, 'Nährwert gelöscht.');
|
||||
return null;
|
||||
} catch {
|
||||
this.addNotification(true, 'Fehler beim löschen des Nährwerts.');
|
||||
return nutrition
|
||||
this.addNotification(false, 'Nährwert gelöscht.');
|
||||
this.article.nutrition = null;
|
||||
return null;
|
||||
} catch {
|
||||
this.addNotification(true, 'Fehler beim löschen des Nährwerts.');
|
||||
return nutrition
|
||||
}
|
||||
} else {
|
||||
return nutrition;
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Reference in new issue
Block a user