Skip to content

Instantly share code, notes, and snippets.

@h-sakano
Last active September 19, 2018 03:40
Show Gist options
  • Save h-sakano/27135ab97b1a23224becd9e682ce2141 to your computer and use it in GitHub Desktop.
Save h-sakano/27135ab97b1a23224becd9e682ce2141 to your computer and use it in GitHub Desktop.
Firebase Authentication EmailSignup 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="signupWithEmailAndPassword">Register</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 EmailSignup extends Vue {
@Provide()
private email: string = ""
@Provide()
private password: string = ""
private signupWithEmailAndPassword () {
firebase.auth().createUserWithEmailAndPassword(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