From fdf53489eced715e1586f582882cb064721a965e Mon Sep 17 00:00:00 2001 From: therealbobo Date: Sun, 13 Sep 2020 12:07:11 +0200 Subject: service creation/edit fix --- frontend/src/views/Services.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'frontend') 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(); -- cgit v1.2.3-70-g09d2