index.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import React, { Component } from "react";
  2. import ContentWrapper from "@/components/Layout/ContentWrapper";
  3. import { Row, Col } from "reactstrap";
  4. import CaseProgress from "@/components/Main/CaseProgress";
  5. import TableSanksi from "@/components/Banding/TableSanksi";
  6. import { getSanksi } from "@/actions/sanksi";
  7. import Loader from "@/components/Common/Loader";
  8. import { connect } from "react-redux";
  9. class Banding extends Component {
  10. constructor(props) {
  11. super(props);
  12. this.state = {
  13. sanksi: {},
  14. };
  15. }
  16. componentDidMount = async () => {
  17. const { token } = this.props;
  18. const sanksi = await getSanksi(token, { banding: true });
  19. this.setState({ sanksi });
  20. };
  21. render() {
  22. const { sanksi } = this.state;
  23. return (
  24. <ContentWrapper>
  25. <div className="content-heading">Banding</div>
  26. <Row>
  27. <Col lg="4">
  28. <CaseProgress />
  29. </Col>
  30. <Col lg="8">{sanksi.data ? <TableSanksi listData={sanksi.data} to="/app/banding/detail" linkName="Detail" /> : <Loader />}</Col>
  31. </Row>
  32. </ContentWrapper>
  33. );
  34. }
  35. }
  36. const mapStateToProps = (state) => ({ user: state.user, token: state.token });
  37. export default connect(mapStateToProps)(Banding);