Restructured Update Process Into Store
This commit is contained in:
@@ -53,23 +53,6 @@ const cancelEditorCreate = () => {
|
||||
}
|
||||
}
|
||||
|
||||
const updateItem = async () => {
|
||||
const {error} = await supabase
|
||||
.from("contacts")
|
||||
.update(itemInfo.value)
|
||||
.eq('id',itemInfo.value.id)
|
||||
|
||||
if(error) {
|
||||
console.log(error)
|
||||
}
|
||||
|
||||
router.push(`/contacts/show/${currentContact.id}`)
|
||||
toast.add({title: "Kontakt erfolgreich gespeichert"})
|
||||
dataStore.fetchContacts()
|
||||
}
|
||||
|
||||
|
||||
|
||||
setupPage()
|
||||
</script>
|
||||
|
||||
@@ -244,7 +227,7 @@ setupPage()
|
||||
<template #footer>
|
||||
<UButton
|
||||
v-if="mode == 'edit'"
|
||||
@click="updateItem"
|
||||
@click="dataStore.updateItem('contacts',itemInfo)"
|
||||
>
|
||||
Speichern
|
||||
</UButton>
|
||||
|
||||
Reference in New Issue
Block a user