listpage-next 0.0.248 → 0.0.249
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -135,5 +135,23 @@ function setupClient(HttpClient) {
|
|
|
135
135
|
document.body.removeChild(link);
|
|
136
136
|
window.URL.revokeObjectURL(url);
|
|
137
137
|
};
|
|
138
|
+
HttpClient.prototype.upload = async function(url, data, config) {
|
|
139
|
+
const client = this.client;
|
|
140
|
+
const formData = new FormData();
|
|
141
|
+
if (data && 'object' == typeof data) Object.keys(data).forEach((key)=>{
|
|
142
|
+
const value = data[key];
|
|
143
|
+
if (Array.isArray(value)) value.forEach((item)=>{
|
|
144
|
+
formData.append(key, item);
|
|
145
|
+
});
|
|
146
|
+
else if (null != value) formData.append(key, value);
|
|
147
|
+
});
|
|
148
|
+
return client.post(url, formData, {
|
|
149
|
+
...config,
|
|
150
|
+
headers: {
|
|
151
|
+
'Content-Type': 'multipart/form-data',
|
|
152
|
+
...config?.headers
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
};
|
|
138
156
|
}
|
|
139
157
|
export { setupClient };
|
package/dist/api/client/index.js
CHANGED
|
@@ -54,5 +54,8 @@ class HttpClient {
|
|
|
54
54
|
download(url, params, downloadOptions, config) {
|
|
55
55
|
throw new Error('Method should be implemented by setupClient');
|
|
56
56
|
}
|
|
57
|
+
upload(url, params, config) {
|
|
58
|
+
throw new Error('Method should be implemented by setupClient');
|
|
59
|
+
}
|
|
57
60
|
}
|
|
58
61
|
export { HttpClient };
|
|
@@ -183,7 +183,7 @@ function FileManager({ title, storage }) {
|
|
|
183
183
|
}));
|
|
184
184
|
};
|
|
185
185
|
return /*#__PURE__*/ jsxs("div", {
|
|
186
|
-
className: "flex h-
|
|
186
|
+
className: "flex h-full bg-slate-950 text-slate-200 font-sans",
|
|
187
187
|
children: [
|
|
188
188
|
/*#__PURE__*/ jsx(Sidebar, {
|
|
189
189
|
title: title,
|
|
@@ -161,7 +161,7 @@ const deleteFolder = async (folderPath)=>{
|
|
|
161
161
|
const uploadObject = async (file, folderId)=>{
|
|
162
162
|
const prefix = folderId || '';
|
|
163
163
|
const cleanName = file.name.replace(/[^a-zA-Z0-9.-]/g, '_');
|
|
164
|
-
const key = `${prefix}${
|
|
164
|
+
const key = `${prefix}${cleanName}`;
|
|
165
165
|
try {
|
|
166
166
|
const cfg = getStorageConfig();
|
|
167
167
|
const s3 = getS3Client();
|