Skip to content

Commit

Permalink
⚡️ Use mounted to fetch pg csv
Browse files Browse the repository at this point in the history
  • Loading branch information
williamchong committed Jun 21, 2024
1 parent ea8f991 commit bd0de6f
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/pages/gutenberg/free-audio-books.vue
Original file line number Diff line number Diff line change
Expand Up @@ -249,12 +249,6 @@ const DISPLAY_NUMBER = 100;
export default {
name: 'FreeAudioBooks',
layout: 'default',
async asyncData({ $api }) {
const csvData = await $api.$get(fetchGutenbergCsv());
const parsedData = await parseCSV(csvData);
return { parsedData };
},
data() {
return {
parsedData: [],
Expand Down Expand Up @@ -319,9 +313,13 @@ export default {
this.currentDisplayNumber = DISPLAY_NUMBER;
}
},
immediate: true,
},
},
async mounted() {
const csvData = await this.$axios.$get(fetchGutenbergCsv());
this.parsedData = await parseCSV(csvData);
this.currentDisplayNumber = this.parsedData.length;
},
methods: {
handleClickRow(classId) {
logTrackerEvent(this, 'Gutenberg', 'clickDownload', classId, 1);
Expand Down

0 comments on commit bd0de6f

Please sign in to comment.