2021-10-13 03:07:42 +02:00
|
|
|
|
|
|
|
export const state = () => ({
|
|
|
|
users: []
|
|
|
|
})
|
|
|
|
|
|
|
|
export const getters = {
|
2021-10-23 03:08:02 +02:00
|
|
|
getIsUserOnline: state => id => {
|
|
|
|
return state.users.find(u => u.id === id)
|
|
|
|
}
|
2021-10-13 03:07:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
export const actions = {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export const mutations = {
|
2021-10-23 03:08:02 +02:00
|
|
|
resetUsers(state) {
|
|
|
|
state.users = []
|
|
|
|
},
|
2021-10-13 03:07:42 +02:00
|
|
|
updateUser(state, user) {
|
|
|
|
var index = state.users.findIndex(u => u.id === user.id)
|
|
|
|
if (index >= 0) {
|
|
|
|
state.users.splice(index, 1, user)
|
|
|
|
} else {
|
|
|
|
state.users.push(user)
|
|
|
|
}
|
|
|
|
},
|
|
|
|
removeUser(state, user) {
|
|
|
|
state.users = state.users.filter(u => u.id !== user.id)
|
|
|
|
}
|
|
|
|
}
|