Restructured Create Process Into Store

This commit is contained in:
2024-01-15 19:50:26 +01:00
parent f6c1f4219b
commit 9f5a142680
12 changed files with 126 additions and 233 deletions

View File

@@ -37,27 +37,6 @@ const setupPage = () => {
}
const createItem = async () => {
const {data,error} = await supabase
.from("contracts")
.insert([itemInfo.value])
.select()
if(error) {
console.log(error)
} else {
mode.value = "show"
itemInfo.value = {
id: 0,
name: ""
}
toast.add({title: "Vertrag erfolgreich erstellt"})
await dataStore.fetchContracts()
router.push(`/contracts/show/${data[0].id}`)
setupPage()
}
}
const editCustomer = async () => {
router.push(`/contracts/edit/${currentContract.id}`)
setupPage()
@@ -197,7 +176,7 @@ setupPage()
</UButton>
<UButton
v-else-if="mode == 'create'"
@click="createItem"
@click="dataStore.createNewItem('contracts',itemInfo)"
>
Erstellen
</UButton>