diff options
author | therealbobo | 2020-09-13 10:07:11 +0000 |
---|---|---|
committer | therealbobo | 2020-09-13 10:07:11 +0000 |
commit | fdf53489eced715e1586f582882cb064721a965e (patch) | |
tree | 4bf6956f07848350e9b179803f284e99b84fdab1 | |
parent | 042cd78894b7c9ce622715e86cb52e203dbe4b34 (diff) |
service creation/edit fix
-rw-r--r-- | frontend/src/views/Services.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/frontend/src/views/Services.js b/frontend/src/views/Services.js index b95b01c..9f0fbd2 100644 --- a/frontend/src/views/Services.js +++ b/frontend/src/views/Services.js @@ -64,12 +64,33 @@ class Services extends Component { saveService() { if (this.state.portValid && this.state.nameValid) { + const requestOptions = { + method: 'PUT', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ + color: this.state.color, + name: this.state.name, + notes: this.state.notes, + port: this.state.port, + }) + }; + + + fetch('/api/services', requestOptions) + .then(function(response){ + console.log(response); + } + ); + + /* axios.put("/api/services", { name: this.state.name, port: this.state.port, color: this.state.color, notes: this.state.notes }); + */ + this.newService(); this.loadServices(); |