delete custom category and all its data
This commit is contained in:
parent
8333d9a591
commit
955b14ee61
|
|
@ -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);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue