🐛 Fixed Staring history not updating on synced DB
This commit is contained in:
@@ -21,7 +21,7 @@
|
|||||||
<button
|
<button
|
||||||
class="icon"
|
class="icon"
|
||||||
:class="{ stared: entry.star }"
|
:class="{ stared: entry.star }"
|
||||||
@click="toggleStar(index)"
|
@click="toggleStar(entry)"
|
||||||
v-tooltip="{
|
v-tooltip="{
|
||||||
content: !entry.star ? $t('add_star') : $t('remove_star')
|
content: !entry.star ? $t('add_star') : $t('remove_star')
|
||||||
}"
|
}"
|
||||||
@@ -508,8 +508,11 @@ export default {
|
|||||||
toggleCollapse() {
|
toggleCollapse() {
|
||||||
this.showMore = !this.showMore;
|
this.showMore = !this.showMore;
|
||||||
},
|
},
|
||||||
toggleStar(index) {
|
toggleStar(entry) {
|
||||||
this.history[index]["star"] = !this.history[index]["star"];
|
if (fb.currentUser !== null) {
|
||||||
|
fb.toggleStar(entry, !entry.star);
|
||||||
|
}
|
||||||
|
entry.star = !entry.star;
|
||||||
updateOnLocalStorage("history", this.history);
|
updateOnLocalStorage("history", this.history);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -97,6 +97,14 @@ export const fb = {
|
|||||||
.then(({ docs }) => {
|
.then(({ docs }) => {
|
||||||
docs.forEach(e => fb.deleteHistory(e));
|
docs.forEach(e => fb.deleteHistory(e));
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
toggleStar: (entry, value) => {
|
||||||
|
usersCollection
|
||||||
|
.doc(fb.currentUser.uid)
|
||||||
|
.collection("history")
|
||||||
|
.doc(entry.id)
|
||||||
|
.update({ star: value })
|
||||||
|
.catch(e => console.error("error deleting", entry, e));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user