Created
February 1, 2018 05:29
-
-
Save core01/e10ded8de504d8bb919797c0d536c53f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<form class="login-form"> | |
<div class="field"> | |
<label class="label">Email</label> | |
<div class="control"> | |
<input class="input" type="text" placeholder="Email" v-model="email"> | |
</div> | |
</div> | |
<div class="field"> | |
<label class="label">Password</label> | |
<div class="control"> | |
<input class="input" type="password" placeholder="password" v-model="password"> | |
</div> | |
</div> | |
<div class="field is-grouped"> | |
<div class="control"> | |
<button class="button is-link" @click.prevent="login">Login</button> | |
</div> | |
<div class="control"> | |
<button class="button" type="reset">Cancel</button> | |
</div> | |
</div> | |
</form> | |
</template> | |
<style scoped> | |
</style> | |
<script> | |
import { connection } from '../../axios/intersceptor' | |
export default { | |
data () { | |
return { | |
password: '', | |
email: '', | |
} | |
}, | |
methods: { | |
login () { | |
let vm = this | |
let data = { | |
email: this.email, | |
password: this.password, | |
} | |
connection().post('BACKEND_URL', data).then(response => { | |
vm.$store.dispatch('logIn', response.data.token) | |
}).catch(error => { | |
vm.$notify.danger(error.response.data.message) | |
}) | |
}, | |
}, | |
components: {}, | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment