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

@@ -50,22 +50,6 @@ const cancelEditorCreate = () => {
}
}
const updateItem = async () => {
const {error} = await supabase
.from("contracts")
.update(itemInfo.value)
.eq('id',itemInfo.value.id)
if(error) {
console.log(error)
}
router.push(`/contracts/show/${currentContract.id}`)
toast.add({title: "Vertrag erfolgreich gespeichert"})
dataStore.fetchContracts()
}
setupPage()
</script>
@@ -170,7 +154,7 @@ setupPage()
<template #footer>
<UButton
v-if="mode == 'edit'"
@click="updateItem"
@click="dataStore.updateItem('contracts',itemInfo)"
>
Speichern
</UButton>