/** @format */
import * as React from 'react';
import {Result, Button} from 'antd';
import {ResultProps as AntdResultProps} from 'antd/es/result';
interface ResultProps extends AntdResultProps {
    error: null | string;
    onRetry: () => void;
}
const CustomeResuslt: React.FC<ResultProps> = props => {
    const {error, title, subTitle, onRetry, ...rest} = props;
    if (error) {
        return (
            <Result
                status='500'
                title={title}
                subTitle={error}
                extra={
                    <Button type='primary' onClick={onRetry}>
                        重试
                    </Button>
                }
            />
        );
    }
    return <>{props.children}</>;
};
export default CustomeResuslt;
