index.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. import { createLog } from "@/actions/log";
  10. import { getCsrf } from "../../../actions/security";
  11. class Banding extends Component {
  12. constructor(props) {
  13. super(props);
  14. this.state = {
  15. sanksi: {},
  16. };
  17. }
  18. componentDidMount = async () => {
  19. const { token } = this.props;
  20. const getTokenCsrf = await getCsrf();
  21. const _csrf = getTokenCsrf.token;
  22. await createLog(token, { aktivitas: "Mengakses halaman Banding", menu: "Banding", _csrf: _csrf });
  23. const sanksi = await getSanksi(token, { banding: true });
  24. this.setState({ sanksi });
  25. };
  26. render() {
  27. const { sanksi } = this.state;
  28. return (
  29. <ContentWrapper>
  30. <div className="content-heading">
  31. <span className="font-color-white">Banding</span>
  32. </div>
  33. <Row>
  34. {/* <Col lg="4">
  35. <CaseProgress />
  36. </Col> */}
  37. <Col lg="12">{sanksi.data ? <TableSanksi listData={sanksi.data} to="/app/banding/detail" linkName="Detail" /> : <Loader />}</Col>
  38. </Row>
  39. </ContentWrapper>
  40. );
  41. }
  42. }
  43. const mapStateToProps = (state) => ({ user: state.user, token: state.token });
  44. export default connect(mapStateToProps)(Banding);