Fixed format of events
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<span @click="downloadFile">{{ title }}</span>
|
||||
<span v-if="title" @click="downloadFile">{{ title }}</span>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
@@ -8,20 +8,33 @@ import axios from 'axios';
|
||||
export default {
|
||||
name: 'DownloadLink',
|
||||
props: {
|
||||
title: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
hash: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
extension: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
title: '',
|
||||
link: '',
|
||||
};
|
||||
},
|
||||
async created() {
|
||||
await this.fetchFile();
|
||||
},
|
||||
methods: {
|
||||
async fetchFile() {
|
||||
try {
|
||||
console.log(this.hash);
|
||||
const response = await axios.get('/files/hash/' + this.hash);
|
||||
this.title = response.data.title;
|
||||
console.log('Fetched files:', response.data.events);
|
||||
this.events = response.data.events;
|
||||
} catch (error) {
|
||||
console.error('Fehler beim Abrufen der Events', error);
|
||||
}
|
||||
},
|
||||
|
||||
async downloadFile() {
|
||||
const response = await axios.get(`/files/download/${this.hash}`, {
|
||||
responseType: 'blob'
|
||||
|
||||
Reference in New Issue
Block a user