fix: tags count not decreasing on untag/uncolor

This commit is contained in:
thecodrr
2020-02-07 04:21:54 +05:00
parent e3165c3b22
commit 38c1d9ef66

View File

@@ -28,10 +28,10 @@ export default class Tags {
if (!id || id.trim().length <= 0) return;
let tag = this.collection.getItem(id);
if (!tag) return;
if (tag.count <= 1) {
tag.count--;
if (tag.count === 0) {
await this.collection.removeItem(id);
} else {
tag.count--;
await this.collection.addItem(tag);
}
}