import { Button } from "antd";
import React from "react";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import { scanStart } from "../../../redux/scan/scan.actions";
import { selectScanLoading } from "../../../redux/scan/scan.selectors";

const mapStateToProps = createStructuredSelector({
  scanLoading: selectScanLoading,
});
const mapDispatchToProps = (dispatch) => ({
  scanStart: () => dispatch(scanStart()),
});

export function ScanRefreshAtom({ scanLoading, scanStart }) {
  return (
    <Button onClick={() => scanStart()} loading={scanLoading}>
      Refresh
    </Button>
  );
}
export default connect(mapStateToProps, mapDispatchToProps)(ScanRefreshAtom);
