Skip to content

Instantly share code, notes, and snippets.

@h-sakano
Created September 19, 2018 03:40
Show Gist options
  • Select an option

  • Save h-sakano/f924916e83aef1763437daad3514a7d8 to your computer and use it in GitHub Desktop.

Select an option

Save h-sakano/f924916e83aef1763437daad3514a7d8 to your computer and use it in GitHub Desktop.
Firebase Authentication EmailSignin Component
<template>
<div>
<div class="row">
<div class="col s12">
<input type="text" placeholder="E-mail" v-model="email">
<input type="password" placeholder="Password" v-model="password">
</div>
</div>
<div class="row">
<div class="col s12">
<button class="waves-light waves-effect btn blue" @click="signinWithEmailAndPassword">Sign in</button>
</div>
</div>
</div>
</template>
<script lang="ts">
import {
Component,
Provide,
Vue
} from "nuxt-property-decorator"
import firebase from "~/plugins/firebase"
@Component({})
export default class EmailSignin extends Vue {
@Provide()
private email: string = ""
@Provide()
private password: string = ""
private signinWithEmailAndPassword () {
firebase.auth().signInWithEmailAndPassword(this.email, this.password)
.catch((error) => {
alert(error.message)
})
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment