Created
June 28, 2017 09:18
-
-
Save xerosanyam/9f771c52085f0cb2f3f26891802f9756 to your computer and use it in GitHub Desktop.
second step
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
<!-- contains what to do on signin succss --> | |
<template> | |
<div> | |
<h1>Signup succeeded</h1> | |
<button @click='logOut'>Log out</button> | |
<hr> | |
<img :src="photo" style='height: 120px'> <br> | |
<p>{{name}}</p> | |
<p>{{email}}</p> | |
<p>{{userId}}</p> | |
<hr> | |
<pre>{{user}}</pre> | |
</div> | |
</template> | |
<script> | |
import firebase from 'firebase' | |
export default { | |
data(){ | |
return { | |
photo: '', | |
userId: '', | |
name: '', | |
email: '', | |
user: {} | |
} | |
}, | |
created() { | |
var vm = this | |
firebase.auth().onAuthStateChanged(function(user) { | |
if (user) { | |
vm.user = user; | |
vm.name = vm.user.displayName; | |
vm.email = vm.user.email; | |
vm.photo = vm.user.photoURL; | |
vm.userId = vm.user.uid; | |
} | |
}); | |
}, | |
methods: { | |
logOut() { | |
firebase.auth().signOut(); | |
} | |
}, | |
}; | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment