import React from 'react';
import { Popconfirm, Button } from 'antd';
import Auth from './index';

export default (props) => {
  const { code, fallback, title = '请确认进行此操作?', onClick, popProps, ...leftProps } = props;

  return (
    <Auth code={code} fallback={fallback}>
      <Popconfirm
          okText="确定"
          cancelText="取消"
          {...popProps}
          title={title}
          onConfirm={onClick}
        >
          <Button style={{ padding: 0 }} danger type="link" { ...leftProps } />
        </Popconfirm>      
    </Auth>
  )
}
