APIBrowser.js 681 B

123
  1. import React from'react';import Module from'../Module';import API from'../../systems/services/API';import'./APIBrowser.css';class APIBrowser extends Module{constructor(a){super(a),this.state={result:''// this.api.onUpdate((v) => console.log("API SET"));
  2. }}update(a){// let API = this.api.value;
  3. API.get(a).then(a=>{this.setState({result:a})})}render(){return React.createElement('div',{className:'APIBrowser'},React.createElement('div',null,React.createElement('input',{type:'text',onBlur:a=>this.update(a.target.value)})),React.createElement('div',null,JSON.stringify(this.state.result)),super.render())}}APIBrowser.Inputs={api:{type:Module.Types.Link}};export default APIBrowser;