diff --git a/app/views/console/comps/header.phtml b/app/views/console/comps/header.phtml
index 72fee14e6..af1d9666a 100644
--- a/app/views/console/comps/header.phtml
+++ b/app/views/console/comps/header.phtml
@@ -223,8 +223,7 @@
-
+ id="upload-modal" style="position: absolute; right:0; bottom: 20; background: white;z-index: 9999;">
@@ -235,19 +234,32 @@
document.addEventListener('alpine:init', () => {
Alpine.store('uploader', {
files: [],
- addFile(file) {
+ addFile(file){
this.files.push(file);
console.log(this.files);
},
- async uploadFile(event) {
- event.preventDefault();
+ async uploadFile(target) {
/* console.dir(event.target); */
- const formData = new FormData(event.target);
+ const formData = new FormData(target);
console.dir(formData.get('file'));
const sdk = window.ls.container.get('sdk');
- console.log(formData.get('read'));
- const file = await sdk.storage.createFile(formData.get('bucketId'), formData.get('fileId'), formData.get('file'), formData.get('read') ?? [], formData.get('write') ?? []);
- console(file);
+ console.log(JSON.parse(formData.get('read')));
+ let read = formData.get('read');
+ if(read) {
+ read = JSON.parse(read);
+ }
+
+ let write = formData.get('write');
+ if(write) {
+ write = JSON.parse(wirte);
+ }
+ const file = await sdk.storage.createFile(
+ formData.get('bucketId'),
+ formData.get('fileId'),
+ formData.get('file'),
+ read,
+ write);
+ this.files.push(file.name);
}
});
diff --git a/app/views/console/storage/bucket.phtml b/app/views/console/storage/bucket.phtml
index c4592a7bf..2b23e0443 100644
--- a/app/views/console/storage/bucket.phtml
+++ b/app/views/console/storage/bucket.phtml
@@ -262,7 +262,7 @@ $fileLimitHuman = $this->getParam('fileLimitHuman', 0);
data-analytics-category="console"
data-analytics-label="Create Storage File"
x-data
- @submit="$store.uploader.uploadFile"
+ @submit.prevent="$store.uploader.uploadFile($event.target)"
>