Last active
August 16, 2019 20:28
-
-
Save ricardosilva86/adeab6a5a6ff2d7c64d836cd07a78747 to your computer and use it in GitHub Desktop.
eslint is complaining about line 12
This file contains 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 characters
Show hidden characters
{ | |
"env": { | |
"browser": true, | |
"node": true, | |
"commonjs": true, | |
"es6": true, | |
"mocha": true | |
}, | |
"extends": [ | |
"eslint:recommended", | |
"plugin:react/recommended" | |
], | |
"parserOptions": { | |
"parser": "babel-eslint", | |
"ecmaVersion": 2018, | |
"ecmaFeatures": { | |
"jsx": true, | |
"experimentalObjectRestSpread": true | |
}, | |
"sourceType": "module" | |
}, | |
"plugins": [ | |
"react" | |
], | |
"rules": { | |
"indent": [ | |
"error", | |
"tab" | |
], | |
"arrow-body-style": ["error", "as-needed"], | |
"linebreak-style": [ | |
"error", | |
"unix" | |
], | |
"quotes": [ | |
"error", | |
"double" | |
], | |
"semi": [ | |
"error", | |
"always" | |
], | |
"no-unused-vars": [ | |
"error", | |
{ | |
"varsIgnorePattern": "should" | |
} | |
] | |
} | |
} |
This file contains 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 characters
import React, {Component} from "react"; | |
import axios from "axios"; | |
import $ from "jquery"; | |
class CreateNewMainTopic extends Component{ | |
constructor(props){ | |
super(props); | |
this.onSubmit = this.onSubmit.bind(this); | |
this.inputTitle = React.createRef(); | |
this.inputPercentage = React.createRef(); | |
} | |
static defaultProps = { | |
title: "MainTopic title", | |
percentage_concluded: "0" | |
}; | |
onSubmit(e){ | |
e.preventDefault(); | |
axios.post("http://localhost:8080/api/maintopic", | |
{ | |
title: this.inputTitle.current.value, | |
percentage_concluded: this.inputPercentage.current.value | |
}) | |
.then( | |
$.ajax({ | |
url: "/api/all", | |
dataType: "json", | |
success: function (dados) { | |
this.setState({matter: dados}) | |
}.bind(this) | |
}) | |
); | |
}; | |
render() { | |
const {title, percentage_concluded} = this.props; | |
return( | |
<div className="card mb-3"> | |
<div className="card-header">Add a New Main Topic</div> | |
<div className="card-body"> | |
<form onSubmit={this.onSubmit}> | |
<div className="form-group"> | |
<label htmlFor="title">Title</label> | |
<input type="text" className="form-control " name="title" placeholder="Title" defaultValue={title} ref={this.inputTitle}/> | |
</div> | |
<div className="form-group"> | |
<label htmlFor="percentage_concluded">Percentage Concluded</label> | |
<input type="number" className="form-control " name="percentage_concluded" placeholder="Percentage Concluded" defaultValue={percentage_concluded} ref={this.inputPercentage}/> | |
</div> | |
<input type="submit" className="btn btn-light"/> | |
</form> | |
</div> | |
</div> | |
); | |
} | |
} | |
export default CreateNewMainTopic; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment