Web: Fix unsubscribe

This commit is contained in:
Alexey Safronov 2023-06-14 11:47:59 +04:00
parent 57f3d614eb
commit 6de4da217b

View File

@ -791,25 +791,29 @@ class FilesStore {
if (folders.length === 0 && this.folders.length === 0) return;
if (this.folders?.length > 0) {
socketHelper.emit({
command: "unsubscribe",
data: {
roomParts: this.folders.map((f) => `DIR-${f.id}`),
individual: true,
},
});
this.folders.forEach((f) =>
socketHelper.emit({
command: "unsubscribe",
data: {
roomParts: `DIR-${f.id}`,
individual: true,
},
})
);
}
this.folders = folders;
if (this.folders?.length > 0) {
socketHelper.emit({
command: "subscribe",
data: {
roomParts: this.folders.map((f) => `DIR-${f.id}`),
individual: true,
},
});
this.folders.forEach((f) =>
socketHelper.emit({
command: "subscribe",
data: {
roomParts: `DIR-${f.id}`,
individual: true,
},
})
);
}
};