|
@@ -3,28 +3,35 @@ import ContentWrapper from "@/components/Layout/ContentWrapper";
|
|
|
import { Row, Col } from "reactstrap";
|
|
import { Row, Col } from "reactstrap";
|
|
|
import { getSanksi } from "@/actions/sanksi";
|
|
import { getSanksi } from "@/actions/sanksi";
|
|
|
import TableSanksi from "@/components/PT/TableSanksi";
|
|
import TableSanksi from "@/components/PT/TableSanksi";
|
|
|
|
|
+import { connect } from "react-redux";
|
|
|
|
|
|
|
|
class PencabutanSanksi extends Component {
|
|
class PencabutanSanksi extends Component {
|
|
|
constructor(props) {
|
|
constructor(props) {
|
|
|
super(props);
|
|
super(props);
|
|
|
|
|
+ this.state = {
|
|
|
|
|
+ sanksi: {},
|
|
|
|
|
+ };
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- static getInitialProps = async () => {
|
|
|
|
|
- const sanksi = await getSanksi({ ptId: "0BCE4DB7-B207-445D-8D03-0C54B7688252" });
|
|
|
|
|
- return { sanksi };
|
|
|
|
|
|
|
+ componentDidMount = async () => {
|
|
|
|
|
+ const { user } = this.props;
|
|
|
|
|
+ const org_id = user.peran[0].organisasi.id;
|
|
|
|
|
+ const sanksi = await getSanksi({ ptId: org_id });
|
|
|
|
|
+ this.setState({ sanksi });
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
render() {
|
|
render() {
|
|
|
- const { sanksi } = this.props;
|
|
|
|
|
|
|
+ const { sanksi } = this.state;
|
|
|
return (
|
|
return (
|
|
|
<ContentWrapper>
|
|
<ContentWrapper>
|
|
|
<div className="content-heading">Permohonan Pencabutan Sanksi</div>
|
|
<div className="content-heading">Permohonan Pencabutan Sanksi</div>
|
|
|
<Row>
|
|
<Row>
|
|
|
- <Col lg={12}>{sanksi.data.length > 0 ? <TableSanksi listData={sanksi.data} to="/app/pt/pencabutan-sanksi/detail" linkName="Detail" /> : ""}</Col>
|
|
|
|
|
|
|
+ <Col lg={12}>{sanksi.data && sanksi.data.length ? <TableSanksi listData={sanksi.data} to="/app/pt/pencabutan-sanksi/detail" linkName="Detail" /> : ""}</Col>
|
|
|
</Row>
|
|
</Row>
|
|
|
</ContentWrapper>
|
|
</ContentWrapper>
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-export default PencabutanSanksi;
|
|
|
|
|
|
|
+const mapStateToProps = (state) => ({ user: state.user });
|
|
|
|
|
+export default connect(mapStateToProps)(PencabutanSanksi);
|