Restructured Update Process Into Store

This commit is contained in:
2024-01-15 21:54:12 +01:00
parent 9f5a142680
commit 497d768d4e
20 changed files with 176 additions and 918 deletions

View File

@@ -55,24 +55,6 @@ const cancelEditorCreate = () => {
}
}
const updateItem = async () => {
const {error} = await supabase
.from("plants")
.update(itemInfo.value)
.eq('id',itemInfo.value.id)
if(error) {
console.log(error)
}
router.push(`/plants/show/${currentItem.id}`)
toast.add({title: "Anlage erfolgreich gespeichert"})
dataStore.fetchPlants()
}
setupPage()
</script>
@@ -174,7 +156,7 @@ setupPage()
<template #footer>
<UButton
v-if="mode == 'edit'"
@click="updateItem"
@click="dataStore.updateItem('plants',itemInfo)"
>
Speichern
</UButton>