Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import Vue from 'vue'
- import Vuex from 'vuex'
- const fb = require('./firebaseConfig.js')
- Vue.use(Vuex)
- // handle page reload
- fb.auth.onAuthStateChanged(user => {
- if (user) {
- fb.usersCollection.doc(user.uid).onSnapshot(doc => {
- store.commit('setUserProfile', doc.data())
- })
- store.commit('setCurrentUser', user)
- store.dispatch('fetchUserProfile')
- // realtime updates from our posts collection
- fb.postsCollection.orderBy('createdOn',
Add Comment
Please, Sign In to add comment