📜  jason rpc reactjs - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:02.387000             🧑  作者: Mango

代码示例1
import JsonRpcClient from '/path/to/jsonrpcclient'class TutoringCalendar extends Component {  componentDidMount() {    var api = new JsonRpcClient({      endpoint: 'https://url.to/api',      headers: {        'X-Token': this.state.token      }    })    api.request(      METHOD_NAME,      PARAM_1,      PARAM_2,      PARAM_3    ).then(function(response) {        this.setState({apiResponse: response})      }.bind(this)) // End .then()  } // End componentDidMount} // End class