mirror of
https://github.com/thelounge/thelounge
synced 2024-11-26 14:00:21 +00:00
24 lines
662 B
JavaScript
24 lines
662 B
JavaScript
"use strict";
|
|
|
|
const socket = require("../socket");
|
|
const {switchToChannel, navigate} = require("../router");
|
|
const store = require("../store").default;
|
|
|
|
socket.on("quit", function(data) {
|
|
// If we're in a channel, and it's on the network that is being removed,
|
|
// then open another channel window
|
|
const isCurrentNetworkBeingRemoved =
|
|
store.state.activeChannel && store.state.activeChannel.network.uuid === data.network;
|
|
|
|
store.commit("removeNetwork", data.network);
|
|
|
|
if (!isCurrentNetworkBeingRemoved) {
|
|
return;
|
|
}
|
|
|
|
if (store.state.networks.length > 0) {
|
|
switchToChannel(store.state.networks[0].channels[0]);
|
|
} else {
|
|
navigate("Connect");
|
|
}
|
|
});
|