Skip to content

Instantly share code, notes, and snippets.

@gpDA
Created May 12, 2019 21:20
Show Gist options
  • Save gpDA/b02be2dc7608716ea218815313f00a5b to your computer and use it in GitHub Desktop.
Save gpDA/b02be2dc7608716ea218815313f00a5b to your computer and use it in GitHub Desktop.
// axios GET request
componentDidMount(){
axios.get('http://127.0.0.1:8000/api/bandwidth')
.then(response => {
// console.log(response.data);
// set Initial data
this.setState({
data: response.data,
loaded: true
})
})
}
// ...
// Submit event
handleSubmit = (event) => {
event.preventDefault();
const data = new FormData(event.target);
// const [device_uuid, end_time, window_time, num_windows] = [data.get('device_uuid'), data.get('end_time'), data.get('window_time'), data.get('num_windows')]
const [end_time, window_time, num_windows] = [data.get('end_time'), data.get('window_time'), data.get('num_windows')]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment