Optimisation DB et Migration

This commit is contained in:
2026-05-26 01:11:11 +02:00
parent 2c35fe53b9
commit 664044bcd6
5 changed files with 37 additions and 8 deletions
+6 -3
View File
@@ -22,9 +22,11 @@ export function Skills() {
async function saveCategory() {
if (editCat) {
await supabase.from('categories').update({ name: newCatName, color: newCatColor }).eq('id', editCat)
const { error } = await supabase.from('categories').update({ name: newCatName, color: newCatColor }).eq('id', editCat)
if (error) { toast.error(error.message); return }
} else {
await supabase.from('categories').insert({ name: newCatName, color: newCatColor })
const { error } = await supabase.from('categories').insert({ name: newCatName, color: newCatColor })
if (error) { toast.error(error.message); return }
}
setCatDialogOpen(false)
setEditCat(null)
@@ -40,7 +42,8 @@ export function Skills() {
}
async function saveSkill() {
await supabase.from('skills').insert({ name: newSkill.name, category_id: newSkill.category_id })
const { error } = await supabase.from('skills').insert({ name: newSkill.name, category_id: newSkill.category_id })
if (error) { toast.error(error.message); return }
setSkillDialogOpen(false)
setNewSkill({ name: '', category_id: '' })
refetchSkills()