UserView and AdminView components
This commit is contained in:
parent
c43cbd507f
commit
4143b4e415
3 changed files with 66 additions and 9 deletions
|
@ -6,9 +6,11 @@
|
|||
</section>
|
||||
|
||||
<section v-if="is_admin" class="section">
|
||||
<ConfigView />
|
||||
<CalendarAssistant />
|
||||
<DoorMapEditor />
|
||||
<AdminView />
|
||||
</section>
|
||||
|
||||
<section v-else class="section">
|
||||
<UserView />
|
||||
</section>
|
||||
|
||||
<section class="section">
|
||||
|
@ -20,17 +22,15 @@
|
|||
<script lang="ts">
|
||||
import { Options, Vue } from "vue-class-component";
|
||||
|
||||
import CalendarAssistant from "./components/admin/CalendarAssistant.vue";
|
||||
import ConfigView from "./components/admin/ConfigView.vue";
|
||||
import DoorMapEditor from "./components/admin/DoorMapEditor.vue";
|
||||
import AdminView from "./components/admin/AdminView.vue";
|
||||
import AdminButton from "./components/AdminButton.vue";
|
||||
import UserView from "./components/UserView.vue";
|
||||
|
||||
@Options({
|
||||
components: {
|
||||
ConfigView,
|
||||
CalendarAssistant,
|
||||
DoorMapEditor,
|
||||
AdminView,
|
||||
AdminButton,
|
||||
UserView,
|
||||
},
|
||||
})
|
||||
export default class extends Vue {
|
||||
|
|
33
ui/src/components/UserView.vue
Normal file
33
ui/src/components/UserView.vue
Normal file
|
@ -0,0 +1,33 @@
|
|||
<template>
|
||||
<Calendar :doors="doors" />
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { DoorsSaved } from "@/lib/api";
|
||||
import { Door } from "@/lib/door";
|
||||
import { Options, Vue } from "vue-class-component";
|
||||
|
||||
import Calendar from "./Calendar.vue";
|
||||
|
||||
@Options({
|
||||
components: {
|
||||
Calendar,
|
||||
},
|
||||
})
|
||||
export default class extends Vue {
|
||||
public doors: Door[] = [];
|
||||
|
||||
public mounted(): void {
|
||||
this.$advent22
|
||||
.api_get<DoorsSaved>("user/doors")
|
||||
.then((data) => {
|
||||
this.doors.length = 0;
|
||||
|
||||
for (const value of data) {
|
||||
this.doors.push(Door.load(value));
|
||||
}
|
||||
})
|
||||
.catch((error) => alert(this.$advent22.format_user_error(error)));
|
||||
}
|
||||
}
|
||||
</script>
|
24
ui/src/components/admin/AdminView.vue
Normal file
24
ui/src/components/admin/AdminView.vue
Normal file
|
@ -0,0 +1,24 @@
|
|||
<template>
|
||||
<ConfigView />
|
||||
<CalendarAssistant />
|
||||
<DoorMapEditor />
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Options, Vue } from "vue-class-component";
|
||||
|
||||
import CalendarAssistant from "./CalendarAssistant.vue";
|
||||
import ConfigView from "./ConfigView.vue";
|
||||
import DoorMapEditor from "./DoorMapEditor.vue";
|
||||
|
||||
@Options({
|
||||
components: {
|
||||
ConfigView,
|
||||
CalendarAssistant,
|
||||
DoorMapEditor,
|
||||
},
|
||||
})
|
||||
export default class extends Vue {}
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
Loading…
Reference in a new issue