index.js 1.2 KB

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