hardlounge/client/js/socket-events/setting.js
2019-11-25 20:13:12 +02:00

21 lines
504 B
JavaScript

"use strict";
import socket from "../socket";
import store from "../store";
socket.on("setting:new", function(data) {
const name = data.name;
const value = data.value;
store.dispatch("settings/update", {name, value, sync: false});
});
socket.on("setting:all", function(settings) {
if (Object.keys(settings).length === 0) {
store.dispatch("settings/syncAll");
} else {
for (const name in settings) {
store.dispatch("settings/update", {name, value: settings[name], sync: false});
}
}
});