|
@@ -6,6 +6,7 @@ const createStore = () => {
|
|
|
headlines: [],
|
|
|
loading: false,
|
|
|
category: '',
|
|
|
+ token: '',
|
|
|
country: 'us'
|
|
|
},
|
|
|
mutations: {
|
|
@@ -20,6 +21,9 @@ const createStore = () => {
|
|
|
},
|
|
|
setCountry (state, country) {
|
|
|
state.country = country
|
|
|
+ },
|
|
|
+ setToken (state, token) {
|
|
|
+ state.token = token
|
|
|
}
|
|
|
},
|
|
|
actions: {
|
|
@@ -36,7 +40,7 @@ const createStore = () => {
|
|
|
'/register/',
|
|
|
userPayload
|
|
|
)
|
|
|
- console.log(autuUserData)
|
|
|
+ commit('setToken', autuUserData.idToken)
|
|
|
commit('setLoading', false)
|
|
|
} catch (error) {
|
|
|
console.log(error)
|
|
@@ -47,7 +51,8 @@ const createStore = () => {
|
|
|
headlines: state => state.headlines,
|
|
|
loading: state => state.loading,
|
|
|
category: state => state.category,
|
|
|
- country: state => state.country
|
|
|
+ country: state => state.country,
|
|
|
+ isAuthenticated: state => !!state.token
|
|
|
}
|
|
|
})
|
|
|
}
|