-
Notifications
You must be signed in to change notification settings - Fork 0
50: package update fileuploader #81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
| return 'Файл слишком большой'; | ||
| } | ||
|
|
||
| return undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
это наверное вообще не нужно, если не выполнится ни одно условие то итак будет undefined
| }); | ||
| } | ||
|
|
||
| return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
эта функция по идее void по этому тут не нужен return в конце
| /> | ||
| <FileUploader | ||
| onChange={handleInput} | ||
| // @ts-expect-error - onError пересекается с пропсом DefaultInputPropsT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Это нужно поправить на уровне компонента, иначе он сломан останется. Нужен PR в xi.kit
|
|
||
| const validateBeforeUpload = (files: File[]): string | undefined => { | ||
| const file = files[0]; | ||
| const allowedTypes = ['image/png', 'image/jpeg', 'image/jpg']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Как будто нам нужно расширить поддерживаемые типы. Как минимум, я знаю, что есть ещё webp, который будет работать. Я бы здесь поисследовал и потестировал данное поведение
| const file = files[0]; | ||
| const allowedTypes = ['image/png', 'image/jpeg', 'image/jpg']; | ||
| if (!allowedTypes.includes(file.type)) { | ||
| return 'Поддерживаются только файлы PNG и JPEG'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Подсказка должна совпадать с allowedTypes
| return; | ||
| } | ||
|
|
||
| if (file.size > 5 * 1024 * 1024) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Думаю, что это 5 Мб
No description provided.