diff --git a/src/pages/ListasPage.vue b/src/pages/ListasPage.vue index 515bd55..aee213e 100644 --- a/src/pages/ListasPage.vue +++ b/src/pages/ListasPage.vue @@ -98,7 +98,16 @@ const eliminarLista = (l) => { cancel: true, persistent: true, }).onOk(async () => { - await listaStore.pb.collection("lista").delete(l.id); + if (l.usuarios.length == 1) { + await listaStore.pb.collection("lista").delete(l.id); + } else { + const resultado = l.usuarios.filter( + (user) => user != listaStore.pb.authStore.model.id + ); + l.usuarios = resultado; + await listaStore.pb.collection("lista").update(l.id, l); + } + listListas(); }); };