Created
September 19, 2018 03:29
-
-
Save h-sakano/b342c2f4a802d4ff3715319b89161643 to your computer and use it in GitHub Desktop.
Firebase Authentication Store
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
| export const strict = false |
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
| 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