This commit is contained in:
advplyr 2022-04-15 20:48:39 -05:00
parent ccba8dc3c7
commit ae195e7b58
32 changed files with 626 additions and 191 deletions

View file

@ -46,9 +46,10 @@ class ServerSocket extends EventEmitter {
this.socket.on('disconnect', this.onDisconnect.bind(this))
this.socket.on('init', this.onInit.bind(this))
this.socket.on('user_updated', this.onUserUpdated.bind(this))
this.socket.on('user_item_progress_updated', this.onUserItemProgressUpdated.bind(this))
this.socket.onAny((evt, args) => {
console.log(`[SOCKET] ${this.socket.id}: ${evt} ${JSON.stringify(args)}`)
console.log(`[SOCKET] onAny: ${this.socket.id}: ${evt} ${JSON.stringify(args)}`)
})
}
@ -84,6 +85,12 @@ class ServerSocket extends EventEmitter {
console.log('[SOCKET] User updated', data)
this.emit('user_updated', data)
}
onUserItemProgressUpdated(data) {
console.log('[SOCKET] User Item Progress Updated', JSON.stringify(data))
var progress = data.data
this.$store.commit('user/updateUserMediaProgress', progress)
}
}
export default ({ app, store }, inject) => {