added login logic

This commit is contained in:
Sockenklaus
2021-10-20 01:22:42 +02:00
parent 2896902e12
commit 60618a5eee
10 changed files with 336 additions and 205 deletions

View File

@@ -1,5 +1,7 @@
<template lang="pug">
p {{ state }}
MonthPicker(:selectedMonth="selectedMonth" :selectedYear="selectedYear" @getMonth="selectedMonth = $event" @getYear="selectedYear = $event")
Schedule( :startDate="new Date(selectedYear, selectedMonth)")
@@ -12,6 +14,9 @@ Schedule( :startDate="new Date(selectedYear, selectedMonth)")
import { getYear, getMonth, eachMonthOfInterval, getDaysInMonth, getISODay } from 'date-fns'
import Schedule from '/src/components/Schedule.vue'
import MonthPicker from '/src/components/MonthPicker.vue'
import { useUser } from '@/stores/user'
const state = useUser()
const selectedMonth = ref(getMonth(new Date()))
const selectedYear = ref(getYear(new Date()))

View File

@@ -3,11 +3,11 @@
<form class="m-auto">
<h1 class="h3 mb-3">Bitte einloggen</h1>
<div class="form-floating">
<input type="text" class="form-control" id="usernameInput" placeholder="Benutzername">
<input type="text" class="form-control" id="usernameInput" v-model="input.username" placeholder="Benutzername">
<label for="usernameInput">Benutzername</label>
</div>
<div class="form-floating">
<input type="password" class="form-control" id="passwordInput" placeholder="Passwort">
<input type="password" class="form-control" id="passwordInput" v-model="input.password" placeholder="Passwort">
<label for="passwordInput">Passwort</label>
</div>
@@ -18,12 +18,31 @@
</label>
</div>
<button class="btn btn-lg btn-success w-100 mb-5">Einloggen</button>
<button class="btn btn-lg btn-success w-100 mb-5" @click.prevent="onClick">Einloggen</button>
</form>
</template>
<script setup lang="ts">
import { useUser } from '@/stores/user'
import { onMounted, reactive } from 'vue'
const userStore = useUser()
const input = reactive({
username: '',
password: ''
})
onMounted(() => {
})
async function onClick() {
userStore.login(input.username, input.password)
}
</script>
<style scoped>