je ne sais plus se que contient se commit

This commit is contained in:
antonin gallon 2026-02-09 15:36:00 +01:00
parent c4892e919c
commit 309111c23a
6 changed files with 102 additions and 13 deletions

View file

@ -14,7 +14,7 @@
</k-box>
</template>
<script>
<!-- <script>
export default {
props: {
pageId: String
@ -29,8 +29,7 @@
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()
@ -52,4 +51,42 @@
}
}
}
</script> -->
<script setup>
import { ref } from 'vue'
// Props
const { pageId } = defineProps({
pageId: String
})
// State
const loading = ref(false)
const error = ref(null)
// Methods
async function exportEpub() {
loading.value = true
error.value = null
try {
// Appel API
const response = await $api.post(`epub-export/${pageId}`)
const blob = await response.blob()
// Création du téléchargement
const url = window.URL.createObjectURL(blob)
const a = document.createElement('a')
a.href = url
a.download = pageId + '.epub'
a.click()
} catch (e) {
error.value = 'Erreur : ' + e.message
} finally {
loading.value = false
}
}
</script>