2022-12-14 02:39:32 +00:00
|
|
|
<template>
|
|
|
|
<div class="modal is-active" v-if="active">
|
|
|
|
<div class="modal-background" />
|
|
|
|
|
|
|
|
<div class="modal-card">
|
|
|
|
<form @submit.prevent="submit">
|
|
|
|
<header class="modal-card-head">
|
|
|
|
<p class="modal-card-title">Login</p>
|
|
|
|
<button class="delete" aria-label="close"></button>
|
|
|
|
</header>
|
|
|
|
|
|
|
|
<section class="modal-card-body">
|
|
|
|
<div class="field">
|
|
|
|
<label class="label">Username</label>
|
|
|
|
<div class="control">
|
|
|
|
<input class="input" type="text" v-model="username" />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="field">
|
|
|
|
<label class="label">Password</label>
|
|
|
|
<div class="control">
|
|
|
|
<input class="input" type="password" v-model="password" />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</section>
|
|
|
|
|
|
|
|
<footer class="modal-card-foot">
|
2022-12-21 23:51:25 +00:00
|
|
|
<button class="button is-success" @click="submit()">Login</button>
|
2022-12-14 02:39:32 +00:00
|
|
|
<button class="button is-danger" @click="set_active(false)">
|
|
|
|
Cancel
|
|
|
|
</button>
|
|
|
|
</footer>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import { Vue } from "vue-class-component";
|
|
|
|
|
2023-01-24 23:18:09 +00:00
|
|
|
export default class extends Vue {
|
2023-09-06 16:25:35 +00:00
|
|
|
public active = false;
|
|
|
|
public username = "";
|
|
|
|
public password = "";
|
2022-12-14 02:39:32 +00:00
|
|
|
|
2023-01-17 14:28:11 +00:00
|
|
|
public created() {
|
2022-12-21 23:51:25 +00:00
|
|
|
window.addEventListener("keydown", (e) => {
|
|
|
|
if (e.key == "Escape") this.set_active(false);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2023-01-17 14:28:11 +00:00
|
|
|
public set_active(state: boolean) {
|
2022-12-14 02:39:32 +00:00
|
|
|
this.active = state;
|
|
|
|
|
|
|
|
this.username = "";
|
|
|
|
this.password = "";
|
|
|
|
}
|
|
|
|
|
2023-09-06 16:25:35 +00:00
|
|
|
public submit() {
|
2022-12-14 02:39:32 +00:00
|
|
|
this.$advent22.set_api_auth(this.username, this.password);
|
|
|
|
this.set_active(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|