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>
30 lines
574 B
TypeScript
30 lines
574 B
TypeScript
import socket from "../socket";
|
|
import {store} from "../store";
|
|
|
|
socket.on("sync_sort", function (data) {
|
|
const order = data.order;
|
|
|
|
switch (data.type) {
|
|
case "networks":
|
|
store.commit(
|
|
"sortNetworks",
|
|
(a, b) => (order as string[]).indexOf(a.uuid) - (order as string[]).indexOf(b.uuid)
|
|
);
|
|
|
|
break;
|
|
|
|
case "channels": {
|
|
const network = store.getters.findNetwork(data.target);
|
|
|
|
if (!network) {
|
|
return;
|
|
}
|
|
|
|
network.channels.sort(
|
|
(a, b) => (order as number[]).indexOf(a.id) - (order as number[]).indexOf(b.id)
|
|
);
|
|
|
|
break;
|
|
}
|
|
}
|
|
});
|