thelounge/client/js/helpers/collapseNetwork.ts
Antonio Mika 117c5fa3fd
Added client type checking to webpack (#4619)
* Added client type checking

* Fixed client-side typescript issues
2022-08-23 00:26:07 -07:00

16 lines
427 B
TypeScript

import storage from "../localStorage";
export default (network, isCollapsed) => {
const stored = storage.get("thelounge.networks.collapsed");
const networks = stored ? new Set(JSON.parse(stored)) : new Set();
network.isCollapsed = isCollapsed;
if (isCollapsed) {
networks.add(network.uuid);
} else {
networks.delete(network.uuid);
}
storage.set("thelounge.networks.collapsed", JSON.stringify([...networks]));
};