This commit is contained in:
1 parent
24f14da9b2
commit
dde21c3ac5
54 files changed
+1651
-237
No files matched your search
@@ -1,7 +1,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import Input from "@/components/Input.vue";
|
||||
import {onMounted, ref} from "vue";
|
||||
import {onMounted, ref, watch} from "vue";
|
||||
import {API} from "@/services/api";
|
||||
import {Auth} from "@/services/auth";
|
||||
|
||||
@@ -21,12 +21,23 @@ onMounted(() => {
|
||||
|
||||
const username = ref("")
|
||||
const password = ref("")
|
||||
const invalid = ref(false)
|
||||
|
||||
watch(props, (value, oldValue, onCleanup) => {
|
||||
if(!value.active) {
|
||||
username.value = ""
|
||||
password.value = ""
|
||||
invalid.value = false
|
||||
}
|
||||
})
|
||||
|
||||
async function attemptLogin() {
|
||||
let login = await Auth.login(username.value, password.value)
|
||||
if(login.success){
|
||||
console.log("success", login)
|
||||
emit("success", login)
|
||||
}else{
|
||||
invalid.value = true
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -37,6 +48,7 @@ async function attemptLogin() {
|
||||
<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"/>
|
||||
<span v-if="invalid" style="color: red; text-align: center; margin-bottom: 10px">Benutzername oder<br> Passwort falsch.</span>
|
||||
<button @click="attemptLogin"><i>login</i>Anmelden</button>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in new issue
Block a user