import BaseDialog from './BaseDialog';
import React from 'react';
import M from 'immutable';
import {post} from 'common/xFetch2';

import {
  Modal,
  Spin
} from 'antd';

class DeleteDialog extends React.Component {
  constructor(props) {
    super(props);
    this.defaultProps = {
      title: '删除',
      name: '删除'
    };
  }

  handleSubmit = (values, successCb, errorCb) => {
    post(this.props.api).then((ret) => {
      successCb({
        message: '删除成功'
      });
    }, (ret) => {
      errorCb(ret);
    });
  }

  render() {
    return (
      <BaseDialog 
        {...this.props}
        type="confirm"
        handleSubmit={this.handleSubmit}
        />
    )
  }
}

export default DeleteDialog;