debut logique pour post sur la route

This commit is contained in:
2024-12-04 14:05:11 +01:00
parent 5a6990faa1
commit b78154c582
5 changed files with 86 additions and 12 deletions

View File

@ -5,7 +5,7 @@
<!-- Première section -->
<div
class="w-full sm:w-1/3 max-sm:h-2/5 p-4 sm:m-6 sm:mr-0 rounded-xl dark:bg-NcBlack/40 bg-white/80">
<WebContentViewer :translate="translate" @zip-upload="handleZipUpload" @file-upload="handleFileUpload" @dragEnded="toggleDragEnded" zipUrl="http://localhost:8000/dummyZip.zip"/>
<WebContentViewer :translate="translate" @zip-upload="handleZipUpload" @file-upload="handleFileUpload" @dragEnded="toggleDragEnded" :zipUrl="zipUrl"/>
</div>
<!-- Deuxième section -->
<div
@ -38,7 +38,11 @@ export default {
WebContentViewer
},
data() {
console.log('feur')
let zipUrl = document.getElementById('archiveInfos').getAttribute('dataarchiveurl');
console.log(zipUrl)
return {
zipUrl,
sharedFile: null,
zip: null,
dragEnded: false,

View File

@ -166,7 +166,20 @@ export default {
methods: {
async loadZipContent() {
try {
const response = await fetch(this.zipUrl);
var baseUrl = OC.generateUrl('/apps/webtransfer/getZipFile');
var postData = {
subUrl: this.zipUrl
};
let response = await fetch(baseUrl, {
method: 'POST',
headers: {
'Content-Type': 'application/json' // Type de contenu JSON
},
body: JSON.stringify(postData) // Convertir les données en JSON
})
console.log('response: ', await response.json())
const zipData = await response.blob();
this.zipName = this.zipUrl.split('/').pop();
const zip = await JSZip.loadAsync(zipData);