Last active
September 19, 2018 03:40
-
-
Save h-sakano/27135ab97b1a23224becd9e682ce2141 to your computer and use it in GitHub Desktop.
Firebase Authentication EmailSignup Component
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> | |
<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