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/JawabanPencabutanSanksi/TableSanksiJawaban";
  6. import { connect } from "react-redux";
  7. import Loader from "@/components/Common/Loader";
  8. class JawabanCabutSanksi 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, { cabutSanksi: true, jawaban: 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">Jawaban Permohonan Pencabutan Sanksi</span>
  26. </div>
  27. <Row>
  28. <Col lg={12}>{sanksi.data?.length ? <TableSanksi listData={sanksi.data} to="/pt/jawaban-pencabutan-sanksi/detail" linkName="Detail" /> : sanksi.data ? "Tidak Ada Sanksi" : <Loader />}</Col>
  29. </Row>
  30. </ContentWrapper>
  31. );
  32. }
  33. }
  34. const mapStateToProps = (state) => ({ user: state.user, token: state.token });
  35. export default connect(mapStateToProps)(JawabanCabutSanksi);