diff --git a/src/pages/configuration/subpage/OtherConfig.tsx b/src/pages/configuration/subpage/OtherConfig.tsx index 2755fbd..3486219 100644 --- a/src/pages/configuration/subpage/OtherConfig.tsx +++ b/src/pages/configuration/subpage/OtherConfig.tsx @@ -1,20 +1,28 @@ import React from "react"; import {Button, Col, Form, InputNumber, Row, Switch, Table} from "antd"; -import {ActionType} from "@ant-design/pro-components"; -import {FormInstance} from "antd/es/form"; -import Column from "antd/es/table/Column"; import RedoOutlined from "@ant-design/icons/lib/icons/RedoOutlined"; +import axiosInstance from "../../../utils/axiosInstance"; class OtherConfig extends React.Component { refresh = () => { - //TODO: refresh - this.setState({forced: true, limit: 0, activated: true}) + axiosInstance.get("management/properties").then((res) => { + console.log(res.data) + this.setState({ + forced: res.data.approvalLimit === 0, + limit: res.data.approvalLimit / 100.0, + activated: true + }) + }) } submit = () => { - //TODO: submit - - this.refresh() + let limit = this.state.limit * 100 + if (this.state.forced) { + limit = 0 + } + axiosInstance.put("management/properties", {approvalLimit: limit}).then((res) => { + this.refresh() + }) } constructor(props: any) { @@ -25,6 +33,7 @@ class OtherConfig extends React.Component { forced: true, refresh: this.refresh } + this.refresh() } static getDerivedStateFromProps(props: any, state: any) { @@ -64,7 +73,7 @@ class OtherConfig extends React.Component { this.refresh() }}>