🚧 Site > Add Vue store

This commit is contained in:
brunosimon
2017-08-04 09:05:44 +02:00
parent 1aa3e5f135
commit eec6f8a796
15 changed files with 114 additions and 23 deletions
+22
View File
@@ -0,0 +1,22 @@
import socketIoClient from 'socket.io-client'
export default
{
name: 'connexion',
created()
{
this.url = `${process.env.NODE_ENV === 'production' ? '' : 'http://localhost:1571'}/projects`
this.socket = socketIoClient(this.url)
this.socket.on('connect', () =>
{
console.log('connected')
})
this.socket.on('update_projects', (data) =>
{
this.$store.commit('updateProjects', data.all)
})
}
}