Created
September 19, 2018 03:40
-
-
Save h-sakano/f924916e83aef1763437daad3514a7d8 to your computer and use it in GitHub Desktop.
Firebase Authentication EmailSignin 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="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