delete custom category and all its data

This commit is contained in:
moist-webDev 2023-06-21 21:58:26 -04:00
parent 8333d9a591
commit 955b14ee61
1 changed files with 2 additions and 1 deletions

View File

@ -58,10 +58,11 @@ export default function OtherCat({theme, otherCategories, setOtherCategories, se
} }
const handleDelete = async () => { const handleDelete = async () => {
const res = await db.from('categories').delete().eq({id: newCat.id}); let res = await db.from('categories').delete().eq({id: newCat.id});
if (res.data) { if (res.data) {
setOtherCategories([...otherCategories.filter((c:any) => c.id !== newCat.id)]) setOtherCategories([...otherCategories.filter((c:any) => c.id !== newCat.id)])
} }
res = await db.from('others').delete().eq({category: newCat.id})
setModalVisible(false); setModalVisible(false);
setNewCat({title: '', showEpisodes: false}); setNewCat({title: '', showEpisodes: false});
setEditPop(false); setEditPop(false);