Skip to content

Instantly share code, notes, and snippets.

@core01
Created February 1, 2018 05:29
Show Gist options
  • Save core01/e10ded8de504d8bb919797c0d536c53f to your computer and use it in GitHub Desktop.
Save core01/e10ded8de504d8bb919797c0d536c53f to your computer and use it in GitHub Desktop.
<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