Skip to content

Commit 527f931

Browse files
committed
fix: fetch presence status often
1 parent f6a72d2 commit 527f931

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/components/StoreCard.vue

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,9 @@
198198
data() {
199199
return {
200200
cardHovered: false,
201+
isInstalled: false,
202+
isFetchingInstalled: false,
203+
isPresenceInstalledInterval: null,
201204
presenceLinkName: this.$props.presence.service
202205
};
203206
},
@@ -210,6 +213,19 @@
210213
this.isPresenceInstalled(this.presence.service).then(response => {
211214
if (response) this.isInstalled = true;
212215
});
216+
217+
this.isPresenceInstalledInterval = setInterval(() => {
218+
if (this.isFetchingInstalled) return;
219+
this.isFetchingInstalled = true;
220+
this.isPresenceInstalled(this.presence.service).then(response => {
221+
if (response) this.isInstalled = true;
222+
else this.isInstalled = false;
223+
this.isFetchingInstalled = false;
224+
});
225+
}, 1000);
226+
},
227+
beforeDestroy() {
228+
clearInterval(this.isPresenceInstalledInterval);
213229
},
214230
methods: {
215231
like() {

0 commit comments

Comments
 (0)