Created
January 12, 2023 19:56
-
-
Save MarlikAlmighty/dcbbfed7ae86d727217192651f2e9190 to your computer and use it in GitHub Desktop.
Revisions
-
MarlikAlmighty created this gist
Jan 12, 2023 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,78 @@ import React from "react"; import axios from "axios"; import 'semantic-ui-css/semantic.min.css'; import { Form, Button, GridRow, Grid, Container, } from "semantic-ui-react"; import Nav from "./Nav"; import List from './List'; import Footer from "./Footer"; const options = [ { key: 'eth', text: 'Ethereum', value: 'eth' }, { key: 'ethsolo', text: 'Ethereum SOLO', value: 'ethsolo' }, { key: 'ethpow', text: 'Ethereum PoW', value: 'ethpow' }, ] export default class App extends React.Component { state = { addr: '', pool: '', } handleChangePool = (event, { value }) => { this.setState({ pool: value }); }; handleChangeAddr = event => { this.setState({ addr: event.target.value }); } handleSubmit = event => { event.preventDefault(); axios.post(`/address`, { pool: this.state.pool, addr: this.state.addr }) .then(() => { this.setState({ addr: "" }); this.setState({ pool: "" }); }) .catch(res => { console.log(res.status + res.statusText); }); }; render() { return ( <div> <Form onSubmit={this.handleSubmit}> <Form.Field> <Form.Select label='Select Pool' options={options} placeholder='Select Pool' onChange={this.handleChangePool} /> <label>Paste Address</label> <input name='addr' placeholder='Paste Address' onChange={this.handleChangeAddr} /> </Form.Field> <Button basic compact color="teal" floated="right" className="ui button"> Submit </Button> </Form> </div > ); } }