-
-
@@ -87,7 +92,7 @@
v-tooltip="`Öffnen`"
href="#"
class="inline-flex btn btn-info btn-sm"
- @click.prevent="open(subsubchild)"
+ @click.prevent="toggle(subsubchild)"
>
@@ -128,10 +133,12 @@ const children = reactive({
var editing = ref(null);
-async function open(parent) {
- const result = (await axios.get(parent.links.children)).data;
-
- children[parent.id] = result.data;
+async function toggle(parent) {
+ if (isOpen(parent.id)) {
+ delete children[parent.id];
+ } else {
+ children[parent.id] = (await axios.get(parent.links.children)).data.data;
+ }
}
async function edit(parent) {
@@ -141,10 +148,6 @@ async function edit(parent) {
};
}
-function close(parent) {
- delete children[parent.id];
-}
-
function isOpen(child) {
return child in children;
}