2023-09-10 00:24:56 +00:00
|
|
|
<template>
|
2023-09-11 23:10:17 +00:00
|
|
|
<LoginModal ref="login_modal" @submit="on_login" />
|
2023-09-10 00:24:56 +00:00
|
|
|
|
|
|
|
|
<BulmaButton
|
|
|
|
|
class="button is-light"
|
|
|
|
|
@click.left="$refs.login_modal.set_active(true)"
|
|
|
|
|
icon="fa-solid fa-toggle-off"
|
|
|
|
|
text="Admin"
|
|
|
|
|
/>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
|
import { Options, Vue } from "vue-class-component";
|
|
|
|
|
|
|
|
|
|
import BulmaButton from "./bulma/Button.vue";
|
|
|
|
|
import LoginModal from "./LoginModal.vue";
|
|
|
|
|
|
|
|
|
|
@Options({
|
|
|
|
|
components: {
|
|
|
|
|
BulmaButton,
|
|
|
|
|
LoginModal,
|
|
|
|
|
},
|
2023-09-11 23:10:17 +00:00
|
|
|
props: {
|
|
|
|
|
modelValue: Boolean,
|
|
|
|
|
},
|
|
|
|
|
emits: ["update:modelValue"],
|
2023-09-10 00:24:56 +00:00
|
|
|
})
|
|
|
|
|
export default class extends Vue {
|
2023-09-11 23:10:17 +00:00
|
|
|
// true, iff Benutzer Admin ist
|
|
|
|
|
public modelValue!: boolean;
|
|
|
|
|
|
2023-09-10 00:24:56 +00:00
|
|
|
declare $refs: {
|
|
|
|
|
login_modal: LoginModal;
|
|
|
|
|
};
|
2023-09-11 23:10:17 +00:00
|
|
|
|
|
|
|
|
public on_login() {
|
|
|
|
|
this.$advent22
|
|
|
|
|
.api_get<boolean>("admin/is_admin")
|
|
|
|
|
.then((is_admin) => this.$emit("update:modelValue", is_admin));
|
|
|
|
|
}
|
2023-09-10 00:24:56 +00:00
|
|
|
}
|
|
|
|
|
</script>
|