Restructured Update Process Into Store
This commit is contained in:
21
spaces/pages/vendors/[mode]/[[id]].vue
vendored
21
spaces/pages/vendors/[mode]/[[id]].vue
vendored
@@ -41,25 +41,6 @@ const cancelEditorCreate = () => {
|
||||
router.push(`/vendors/`)
|
||||
}
|
||||
|
||||
const updateItem = async () => {
|
||||
const {error} = await supabase
|
||||
.from("vendors")
|
||||
.update(itemInfo.value)
|
||||
.eq('id',itemInfo.value.id)
|
||||
|
||||
if(error) {
|
||||
console.log(error)
|
||||
} else {
|
||||
toast.add({title: "Lieferant erfolgreich gespeichert"})
|
||||
router.push(`/vendors/show/${currentItem.value.id}`)
|
||||
dataStore.fetchVendors()
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
setupPage()
|
||||
</script>
|
||||
|
||||
@@ -196,7 +177,7 @@ setupPage()
|
||||
<template #footer>
|
||||
<UButton
|
||||
v-if="mode == 'edit'"
|
||||
@click="updateItem"
|
||||
@click="dataStore.updateItem('vendors',itemInfo)"
|
||||
>
|
||||
Speichern
|
||||
</UButton>
|
||||
|
||||
Reference in New Issue
Block a user