🚧 Site > Add Vue store
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
<template src="./template.html"></template>
|
||||
<script src="./script.js"></script>
|
||||
<style src="./style.styl" lang="stylus"></style>
|
||||
@@ -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)
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
<div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user