première tentative d'export du body en md, pas très concluant

This commit is contained in:
antonin gallon 2025-12-10 14:54:12 +01:00
parent 8c8295b677
commit c4892e919c
16 changed files with 477 additions and 0 deletions

View file

@ -0,0 +1,55 @@
<template>
<k-box>
<k-button
theme="positive"
icon="download"
:disabled="loading"
@click="exportEpub"
>
Exporter en EPUB
</k-button>
<k-text v-if="loading">Génération en cours</k-text>
<k-text v-if="error" theme="negative">{{ error }}</k-text>
</k-box>
</template>
<script>
export default {
props: {
pageId: String
},
data() {
return {
loading: false,
error: null,
}
},
methods: {
async exportEpub() {
this.loading = true;
this.error = null;
console.log(this.pageId)
try {
const response = await this.$api.post(`epub-export/${this.pageId}`);
const blob = await response.blob()
// Télécharger le fichier
const url = window.URL.createObjectURL(blob)
const a = document.createElement('a')
a.href = url
a.download = this.pageId + '.epub'
a.click()
} catch (e) {
this.error = "Erreur : " + e.message
} finally {
this.loading = false
}
}
}
}
</script>