diff --git a/src/utils/exports/SignupsPerDay.js b/src/utils/exports/SignupsPerDay.js index 90dff07a..d719ef81 100644 --- a/src/utils/exports/SignupsPerDay.js +++ b/src/utils/exports/SignupsPerDay.js @@ -37,8 +37,8 @@ export default class UserDataExport extends BaseDataExport { const from = this.date2timestamp(this.config.fields[0].value.from); const to = this.date2timestamp(this.config.fields[0].value.to); + this.header = ["date", "count"]; try { - this.header = ["date", "count"]; const users = await this.fetchUsersInRange(from, to); this.rows = await this.aggregateSignups(users); return this.rows; @@ -54,11 +54,9 @@ export default class UserDataExport extends BaseDataExport { const user_ref = db.ref("users").orderByChild("created").startAt(from).endAt(to); const payload = await user_ref.once("value"); if (!payload.exists()) { - throw "No users found"; + throw new Error("No users found"); } - const users = Object.values(payload.val()); - - return users; + return Object.values(payload.val()); } async aggregateSignups(users) { diff --git a/src/utils/exports/SubscriptionDataExport.js b/src/utils/exports/SubscriptionDataExport.js index 80883fcd..b7127e61 100644 --- a/src/utils/exports/SubscriptionDataExport.js +++ b/src/utils/exports/SubscriptionDataExport.js @@ -1,4 +1,4 @@ -import { db, functions } from "src/firebase"; +import { db } from "src/firebase"; import { makeDate } from "../generalFunctions"; import BaseDataExport from "./BaseDataExport"; diff --git a/src/views/Admin/ExportCSV.vue b/src/views/Admin/ExportCSV.vue index 0c1b465e..da32f9af 100644 --- a/src/views/Admin/ExportCSV.vue +++ b/src/views/Admin/ExportCSV.vue @@ -71,7 +71,6 @@ export default { methods: { async downloadCSV() { const exporter = this.data_export.exporter; - this.data_export; const rows = await exporter.getCSVRows(); exporter.exportToCSV(); },