This commit is contained in:
2024-03-01 22:48:03 +01:00
parent 3924fd79d2
commit b4b70d8e7c
10 changed files with 420 additions and 693 deletions

View File

@@ -405,6 +405,7 @@ export const useDataStore = defineStore('data', () => {
if(supabaseError) {
console.log(supabaseError)
toast.add({title: "Es ist ein Fehler bei der Erstellung aufgetreten", color: "rose"})
} else if (supabaseData) {
await eval( dataType + '.value.push(' + JSON.stringify(...supabaseData) + ')')
toast.add({title: `${dataTypes[dataType].labelSingle} hinzugefügt`})
@@ -425,7 +426,7 @@ export const useDataStore = defineStore('data', () => {
} else if(supabaseData) {
await eval(dataType + '.value[' + dataType + '.value.findIndex(i => i.id === ' + JSON.stringify(data.id) + ')] = ' + JSON.stringify(supabaseData[0]))
toast.add({title: `${dataTypes[dataType].labelSingle} gespeichert`})
if(dataTypes[dataType].redirect) await router.push(`/${dataType}/show/${supabaseData[0].id}`)
if(dataTypes[dataType].redirect) await router.push(`/${dataType}/show/${data.id}`)
return supabaseData
}
}