reordered for custom views

This commit is contained in:
Sebastian Frank
2017-08-29 15:51:50 +02:00
parent 5b250b02fe
commit f7de209197
10 changed files with 51 additions and 51 deletions

55
src/views/forms/login.vue Normal file
View File

@@ -0,0 +1,55 @@
<template>
<div class="LoginForm">
<h2>Login</h2>
<my-form :elements="elements" :buttons="buttons" :submitHandler="login"></my-form>
</div>
</template>
<script>
import MyForm from '../../components/my-form.vue';
export default {
name: 'LoginForm',
components: {
MyForm
},
data() {
return {
username: '',
password: '',
elements: {
username: {
label: 'Benutzername',
type: 'text',
required: true
},
password: {
label: 'Passwort',
type: 'password',
required: true
}
},
buttons: [
{
label: 'login',
type: 'submit'
}
]
}
},
methods: {
login(formData) {
this.$store.dispatch("login", formData)
.then(user => {
console.log("---- user login --------");
console.log(user);
this.$router.go(-1);
})
.catch(error => {
console.log("---- login error -------");
console.log(error);
});
}
}
}
</script>