mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-18 08:12:15 +00:00
Merge remote-tracking branch 'origin/sockets'
# Conflicts: # composer.lock # public/mix-manifest.json
This commit is contained in:
18
resources/js/bootstrap.js
vendored
18
resources/js/bootstrap.js
vendored
@@ -16,13 +16,15 @@ window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'
|
||||
* allows your team to easily build robust real-time web applications.
|
||||
*/
|
||||
|
||||
// import Echo from 'laravel-echo';
|
||||
import Echo from 'laravel-echo';
|
||||
|
||||
// window.Pusher = require('pusher-js');
|
||||
window.Pusher = require('pusher-js');
|
||||
|
||||
// window.Echo = new Echo({
|
||||
// broadcaster: 'pusher',
|
||||
// key: process.env.MIX_PUSHER_APP_KEY,
|
||||
// cluster: process.env.MIX_PUSHER_APP_CLUSTER,
|
||||
// forceTLS: true
|
||||
// });
|
||||
// TODO: set wshost
|
||||
window.Echo = new Echo({
|
||||
broadcaster: 'pusher',
|
||||
key: 'local',
|
||||
wsHost: '192.168.1.112',
|
||||
wsPort: 6001,
|
||||
forceTLS: false
|
||||
});
|
||||
|
||||
2
resources/js/store/index.js
vendored
2
resources/js/store/index.js
vendored
@@ -3,6 +3,7 @@ import Vue from 'vue'
|
||||
|
||||
import uploadRequest from './modules/uploadRequest'
|
||||
import fileFunctions from './modules/fileFunctions'
|
||||
import broadcasting from './modules/broadcasting'
|
||||
import fileBrowser from './modules/fileBrowser'
|
||||
import payments from './modules/payments'
|
||||
import userAuth from './modules/userAuth'
|
||||
@@ -17,6 +18,7 @@ export default new Vuex.Store({
|
||||
modules: {
|
||||
uploadRequest,
|
||||
fileFunctions,
|
||||
broadcasting,
|
||||
fileBrowser,
|
||||
payments,
|
||||
userAuth,
|
||||
|
||||
32
resources/js/store/modules/broadcasting.js
vendored
Normal file
32
resources/js/store/modules/broadcasting.js
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
const defaultState = {
|
||||
isRunningConnection: false,
|
||||
}
|
||||
|
||||
const actions = {
|
||||
runConnection: ({ commit, getters }) => {
|
||||
|
||||
commit('SET_RUNNING_COMMUNICATION')
|
||||
|
||||
Echo.private(`test.${getters.user.data.id}`)
|
||||
.listen('.Domain\\Notifications\\Events\\TestUpdate', (e) => {
|
||||
console.log(e);
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
const mutations = {
|
||||
SET_RUNNING_COMMUNICATION(state) {
|
||||
state.isRunningConnection = true
|
||||
},
|
||||
}
|
||||
|
||||
const getters = {
|
||||
isRunningConnection: (state) => state.isRunningConnection,
|
||||
}
|
||||
|
||||
export default {
|
||||
state: defaultState,
|
||||
getters,
|
||||
actions,
|
||||
mutations,
|
||||
}
|
||||
6
resources/js/store/modules/userAuth.js
vendored
6
resources/js/store/modules/userAuth.js
vendored
@@ -10,7 +10,7 @@ const defaultState = {
|
||||
}
|
||||
|
||||
const actions = {
|
||||
getAppData: ({ commit, getters }) => {
|
||||
getAppData: ({ commit, getters, dispatch }) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios
|
||||
.get(getters.api + '/user' + getters.sorting.URI)
|
||||
@@ -18,6 +18,10 @@ const actions = {
|
||||
resolve(response)
|
||||
|
||||
commit('RETRIEVE_USER', response.data)
|
||||
|
||||
if (! getters.isRunningConnection) {
|
||||
dispatch('runConnection')
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
reject(error)
|
||||
|
||||
Reference in New Issue
Block a user