@fakel/rest-admin
Version:
An application that makes it easier to work with your API
35 lines (34 loc) • 1.14 kB
TypeScript
import React from 'react';
import { UploadProps } from 'antd/lib/upload';
import { FormItemProps } from 'antd/lib/form';
import { DataProviderT } from '../../@types/dataProvider';
import { InputProps } from './Input';
/**
* https://ant.design/components/upload/#header
*
*
* const props = {
name: 'file',
action: 'https://www.mocky.io/v2/5cc8019d300000980a055e76',
headers: {
authorization: 'authorization-text',
},
onChange(info) {
if (info.file.status !== 'uploading') {
console.log(info.file, info.fileList);
}
if (info.file.status === 'done') {
message.success(`${info.file.name} file uploaded successfully`);
} else if (info.file.status === 'error') {
message.error(`${info.file.name} file upload failed.`);
}
},
};
*
* */
interface FileInputProps extends InputProps {
isMultiple?: boolean;
uploadHandler: (dataProvider: DataProviderT, formData: FormData, dataKey: string) => Promise<any>;
}
declare const FileInput: React.FC<FileInputProps & FormItemProps & UploadProps>;
export default FileInput;