Created
May 12, 2019 21:20
-
-
Save gpDA/b02be2dc7608716ea218815313f00a5b to your computer and use it in GitHub Desktop.
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 characters
| // 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