mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-22 20:26:00 +00:00
uploads - moved logic to FE because of plugins
This commit is contained in:
@@ -30,6 +30,7 @@ export function useUploadsZone() {
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('FILE', file);
|
||||
const formData = new FormData();
|
||||
formData.append('data', file);
|
||||
|
||||
@@ -42,6 +43,15 @@ export function useUploadsZone() {
|
||||
const resp = await fetch(`${apiBase}/uploads/upload`, fetchOptions);
|
||||
const fileData = await resp.json();
|
||||
|
||||
fileData.shortName = file.name;
|
||||
|
||||
for (const format of extensions.fileFormats) {
|
||||
if (file.name.endsWith('.' + format.extension)) {
|
||||
fileData.shortName = file.name.slice(-format.extension.length - 1);
|
||||
fileData.storageType = format.storageType;
|
||||
}
|
||||
}
|
||||
|
||||
if (uploadListener) {
|
||||
uploadListener(fileData);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user