Skip to content

Commit 1ab9af6

Browse files
committed
Changes due to antd 6
1 parent 54629ae commit 1ab9af6

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/reactComponents/Menu.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
*/
2121
import * as Antd from 'antd';
2222
import * as React from 'react';
23-
import { RcFile, UploadRequestOption } from 'rc-upload/lib/interface';
2423
import * as commonStorage from '../storage/common_storage';
2524
import * as storageNames from '../storage/names';
2625
import * as storageProject from '../storage/project';
@@ -391,7 +390,7 @@ export function Component(props: MenuProps): React.JSX.Element {
391390
},
392391
onChange: (_info) => {
393392
},
394-
customRequest: (options: UploadRequestOption) => {
393+
customRequest: (options) => {
395394
const reader = new FileReader();
396395
reader.onload = (event) => {
397396
if (!event.target) {
@@ -402,16 +401,20 @@ export function Component(props: MenuProps): React.JSX.Element {
402401
projectNames.forEach(projectName => {
403402
existingProjectNames.push(projectName);
404403
});
405-
const file = options.file as RcFile;
404+
const file = options.file as File;
406405
const uploadProjectName = storageProject.makeUploadProjectName(file.name, existingProjectNames);
407406
if (props.storage) {
408407
storageProject.uploadProject(props.storage, uploadProjectName, dataUrl);
409408
}
409+
if (options.onSuccess) {
410+
options.onSuccess(dataUrl);
411+
}
410412
};
411413
reader.onerror = (_error) => {
412414
console.log('Error reading file: ' + reader.error);
413-
// TODO: i18n
414-
props.setAlertErrorMessage(t('UPLOAD_FAILED') || 'Failed to upload project');
415+
if (options.onError) {
416+
options.onError(new Error(t('UPLOAD_FAILED')));
417+
}
415418
};
416419
reader.readAsDataURL(options.file as Blob);
417420
},

0 commit comments

Comments
 (0)