Update NotifcationCard.vue component, add refresh button for cold notification cache

This commit is contained in:
Daniel Supernault 2021-07-25 03:33:47 -06:00
parent 7274574c68
commit 0e178a3371
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -90,6 +90,7 @@
<div class="text-lighter text-center py-3"> <div class="text-lighter text-center py-3">
<p class="mb-0"><i class="fas fa-inbox fa-3x"></i></p> <p class="mb-0"><i class="fas fa-inbox fa-3x"></i></p>
<p class="mb-0 small font-weight-bold">No notifications yet</p> <p class="mb-0 small font-weight-bold">No notifications yet</p>
<p v-if="showRefresh && !attemptedRefresh" class="mt-2 small font-weight-bold text-primary cursor-pointer" @click="refreshNotifications"><i class="fas fa-redo"></i> Refresh</p>
</div> </div>
</div> </div>
</div> </div>
@ -110,7 +111,9 @@
profile: { profile: {
locked: false locked: false
}, },
followRequests: null followRequests: null,
showRefresh: false,
attemptedRefresh: false
}; };
}, },
@ -152,6 +155,9 @@
this.notificationMaxId = Math.min(...ids); this.notificationMaxId = Math.min(...ids);
this.notifications = data; this.notifications = data;
this.loading = false; this.loading = false;
if(data.length == 0 && !this.attemptedRefresh) {
this.showRefresh = true;
}
//this.notificationPoll(); //this.notificationPoll();
}); });
}, },
@ -307,6 +313,11 @@
} }
return '/i/web/post/_/' + status.account.id + '/' + status.id; return '/i/web/post/_/' + status.account.id + '/' + status.id;
},
refreshNotifications() {
this.attemptedRefresh = true;
this.fetchNotifications();
} }
} }
} }