Added counts to each category
Counts update on certain events and show or hide various elements Fixed various little ui element issues fixes #6
This commit is contained in:
@@ -12,6 +12,7 @@ export default new Vuex.Store({
|
||||
isUserOnMobile: false,
|
||||
isNoteSettingsOpen: false, //Little note settings pane
|
||||
socket: null,
|
||||
userTotals: null,
|
||||
},
|
||||
mutations: {
|
||||
setLoginToken(state, userData){
|
||||
@@ -88,6 +89,14 @@ export default new Vuex.Store({
|
||||
//Put socket id in axios headers
|
||||
axios.defaults.headers.common['socketId'] = socket
|
||||
state.socket = socket
|
||||
},
|
||||
setUserTotals(state, totalsObject){
|
||||
//Save all the totals for the user
|
||||
state.userTotals = totalsObject
|
||||
|
||||
// Object.keys(totalsObject).forEach( key => {
|
||||
// console.log(key + ' -- ' + totalsObject[key])
|
||||
// })
|
||||
}
|
||||
|
||||
},
|
||||
@@ -114,5 +123,16 @@ export default new Vuex.Store({
|
||||
getSocket: state => {
|
||||
return state.socket
|
||||
},
|
||||
totals: state => {
|
||||
return state.userTotals
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
fetchAndUpdateUserTotals ({ commit }) {
|
||||
axios.post('/api/user/totals')
|
||||
.then( ({data}) => {
|
||||
commit('setUserTotals', data)
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
Reference in New Issue
Block a user