mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-05 18:23:48 +00:00
54 lines
1.1 KiB
JavaScript
Vendored
54 lines
1.1 KiB
JavaScript
Vendored
import {events} from "../../bus";
|
|
|
|
const defaultState = {
|
|
isRunningConnection: false,
|
|
}
|
|
|
|
const actions = {
|
|
runConnection: ({ commit, getters, dispatch }) => {
|
|
|
|
commit('SET_RUNNING_COMMUNICATION')
|
|
|
|
Echo.private(`App.Users.Models.User.${getters.user.data.id}`)
|
|
.notification((notification) => {
|
|
|
|
// Play audio
|
|
new Audio('/audio/blop.wav').play();
|
|
|
|
// Call toaster notification
|
|
events.$emit('notification', {
|
|
data: {
|
|
type: notification.category,
|
|
id: notification.id,
|
|
attributes: {
|
|
action: notification.action,
|
|
description: notification.description,
|
|
title: notification.title,
|
|
category: notification.category,
|
|
},
|
|
},
|
|
})
|
|
|
|
// Reload user data to update notifications
|
|
dispatch('getAppData')
|
|
});
|
|
},
|
|
}
|
|
|
|
const mutations = {
|
|
SET_RUNNING_COMMUNICATION(state) {
|
|
state.isRunningConnection = true
|
|
},
|
|
}
|
|
|
|
const getters = {
|
|
isRunningConnection: (state) => state.isRunningConnection,
|
|
}
|
|
|
|
export default {
|
|
state: defaultState,
|
|
getters,
|
|
actions,
|
|
mutations,
|
|
}
|