mirror of
https://github.com/thelounge/thelounge
synced 2024-11-25 21:40:22 +00:00
dd05ee3a65
Co-authored-by: Eric Nemchik <eric@nemchik.com> Co-authored-by: Pavel Djundik <xPaw@users.noreply.github.com>
22 lines
624 B
TypeScript
22 lines
624 B
TypeScript
import socket from "../socket";
|
|
import {store} from "../store";
|
|
|
|
socket.on("setting:new", async function (data) {
|
|
const name = data.name;
|
|
const value = data.value;
|
|
await store.dispatch("settings/update", {name, value, sync: false});
|
|
});
|
|
|
|
socket.on("setting:all", async function (settings) {
|
|
const serverHasSettings = Object.keys(settings).length > 0;
|
|
|
|
store.commit("serverHasSettings", serverHasSettings);
|
|
|
|
if (serverHasSettings) {
|
|
for (const name in settings) {
|
|
await store.dispatch("settings/update", {name, value: settings[name], sync: false});
|
|
}
|
|
} else {
|
|
await store.dispatch("settings/syncAll");
|
|
}
|
|
});
|