WIP
This commit is contained in:
1 parent
d0b1c1d241
commit
00cca5ca9a
11 files changed
+282
-63
No files matched your search
@@ -1,11 +1,70 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import Input from "@/components/Input.vue";
|
||||
import {onMounted, ref} from "vue";
|
||||
import {API} from "@/views/api";
|
||||
|
||||
const props = defineProps<{
|
||||
active: boolean
|
||||
}>()
|
||||
|
||||
const emit = defineEmits(["success"])
|
||||
|
||||
onMounted(() => {
|
||||
window.addEventListener("keydown", ev => {
|
||||
if(props.active && ev.key == "Enter") {
|
||||
attemptLogin()
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
const username = ref("")
|
||||
const password = ref("")
|
||||
|
||||
async function attemptLogin() {
|
||||
let login = await API.login(username.value, password.value)
|
||||
if(login.success){
|
||||
console.log("success", login)
|
||||
emit("success", login)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
<div class="container">
|
||||
<span class="title">Anmelden</span>
|
||||
<Input class="input" v-model:value="username" label="Nutzername"/>
|
||||
<Input class="input" v-model:value="password" label="Passwort" type="password"/>
|
||||
<button><i>login</i>Anmelden</button>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
<style scoped lang="less">
|
||||
|
||||
.container{
|
||||
background: #ffffff;
|
||||
padding: 20px 32px;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
pointer-events: auto;
|
||||
|
||||
.title{
|
||||
display: inline-block;
|
||||
font-size: 24px;
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
|
||||
.input {
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
button{
|
||||
margin-top: 8px;
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
||||
Reference in new issue
Block a user