DoorMapEditor Drawer usage

This commit is contained in:
Jörn-Michael Miehe 2023-09-12 15:51:23 +00:00
parent dbd0e4962c
commit ddb893ea6c

View file

@ -1,5 +1,5 @@
<template> <template>
<BulmaDrawer header="Türchen bearbeiten"> <BulmaDrawer header="Türchen bearbeiten" :ready="is_loaded" @open="on_open">
<div class="is-flex is-align-items-center is-justify-content-space-between"> <div class="is-flex is-align-items-center is-justify-content-space-between">
<BulmaButton <BulmaButton
:disabled="current_step === 0" :disabled="current_step === 0"
@ -67,6 +67,8 @@ import DoorPlacer from "./editor/DoorPlacer.vue";
}, },
}) })
export default class extends Vue { export default class extends Vue {
public is_loaded = true;
public readonly steps: Step[] = [ public readonly steps: Step[] = [
{ label: "Platzieren", icon: "fa-solid fa-crosshairs" }, { label: "Platzieren", icon: "fa-solid fa-crosshairs" },
{ label: "Ordnen", icon: "fa-solid fa-list-ol" }, { label: "Ordnen", icon: "fa-solid fa-list-ol" },
@ -95,6 +97,16 @@ export default class extends Vue {
return this.$advent22.api_put("admin/doors", data); return this.$advent22.api_put("admin/doors", data);
} }
public on_open(): void {
this.is_loaded = false;
this.load_doors()
.then(() => (this.is_loaded = true))
.catch(([reason, endpoint]) => {
alert(`Fehler: ${reason} in ${endpoint}`);
});
}
public mounted(): void { public mounted(): void {
this.load_doors().catch(([reason, endpoint]) => { this.load_doors().catch(([reason, endpoint]) => {
alert(`Fehler: ${reason} in ${endpoint}`); alert(`Fehler: ${reason} in ${endpoint}`);