Fixed paidMembersByCadence always having keys

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

When there is no data in the backend, no keys are added.
This commit is contained in:
Simon Backx 2022-05-10 18:05:10 +02:00
parent 917f17b7e6
commit c36a5bbaeb

View File

@ -344,7 +344,10 @@ export default class DashboardStatsService extends Service {
let statsUrl = this.ghostPaths.url.api('stats/subscriptions');
let result = yield this.ajax.request(statsUrl);
const paidMembersByCadence = {};
const paidMembersByCadence = {
month: 0,
year: 0
};
for (const cadence of result.meta.cadences) {
paidMembersByCadence[cadence] = result.meta.totals.reduce((sum, total) => {