Skip to content

Instantly share code, notes, and snippets.

@h-sakano
Created September 19, 2018 03:29
Show Gist options
  • Select an option

  • Save h-sakano/b342c2f4a802d4ff3715319b89161643 to your computer and use it in GitHub Desktop.

Select an option

Save h-sakano/b342c2f4a802d4ff3715319b89161643 to your computer and use it in GitHub Desktop.
Firebase Authentication Store
export const strict = false
export const state = () => ({
user: null
})
export const getters = {
uid(state) {
if (state.user && state.user.uid) return state.user.uid
else return null
},
user(state) {
return state.user
},
isAuthenticated(state) {
return !!state.user && !!state.user.uid
}
}
export const mutations = {
setUser (state, user) {
state.user = user
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment