0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-24 23:48:13 -05:00

Added loading/error states for whats new entries

refs https://github.com/TryGhost/Team/issues/469

- Adds new loading/error tracked values for whats new entries for error/loading states
This commit is contained in:
Rish 2021-02-25 14:21:28 +05:30
parent ceaf54b60e
commit edc533cc88

View file

@ -48,6 +48,10 @@ export default class DashboardController extends Controller {
@tracked
whatsNewEntries = null;
@tracked
whatsNewEntriesLoading = null;
@tracked
whatsNewEntriesError = null;
get showTopMembers() {
return this.feature.get('emailAnalytics') && this.settings.get('emailTrackOpens');
@ -212,8 +216,13 @@ export default class DashboardController extends Controller {
}
loadWhatsNew() {
this.whatsNewEntriesLoading = true;
this.whatsNew.fetchLatest.perform().then(() => {
this.whatsNewEntriesLoading = false;
this.whatsNewEntries = this.whatsNew.entries.slice(0, 3);
}, (error) => {
this.whatsNewEntriesError = error;
this.whatsNewEntriesLoading = false;
});
}
}