Added login to the application to make authenticated api requests.

This commit is contained in:
krzysiej
2022-06-20 15:05:27 +02:00
parent 4536195a4c
commit 00bb86f798
13 changed files with 230 additions and 9 deletions

View File

@@ -0,0 +1,47 @@
<template>
<form v-on:submit.prevent="handleSubmit">
<div v-if="error" class="alert alert-danger">
{{ error }}
</div>
<div class="form-group">
<label for="exampleInputEmail1">Email address</label>
<input type="email" v-model="email" class="form-control" id="exampleInputEmail1"
aria-describedby="emailHelp" placeholder="Enter email">
</div>
<div class="form-group">
<label for="exampleInputPassword1">Password</label>
<input type="password" v-model="password" class="form-control"
id="exampleInputPassword1" placeholder="Password">
</div>
<div class="form-check">
<input type="checkbox" class="form-check-input" id="exampleCheck1">
<label class="form-check-label" for="exampleCheck1">I like cheese</label>
</div>
<button type="submit" class="btn btn-primary" v-bind:class="{ disabled: isLoading }">Log in</button>
</form>
</template>
<script>
import {mapActions} from "vuex";
export default {
data() {
return {
email: '',
password: '',
error: '',
isLoading: false
}
},
props: ['user'],
methods: {
...mapActions('usermodule', ['login']),
handleSubmit() {
this.login({'email': this.email, 'password': this.password});
},
},
}
</script>
<style scoped lang="scss">
</style>