summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
4bce72d)
This is very similar to fetch_post_json but with a different request
method. In fact, we share the implementation with a new
fetch_method_json that accepts which method to use.
-function fetch_post_json(api = '', data = {}) {
+function fetch_method_json(method, api = '', data = {}) {
const response = fetch(api, {
const response = fetch(api, {
headers: {
'Content-Type': 'application/json'
},
headers: {
'Content-Type': 'application/json'
},
+function fetch_post_json(api = '', data = {}) {
+ return fetch_method_json('POST', api, data);
+}
+
+async function fetch_put_json(api = '', data = {}) {
+ return fetch_method_json('PUT', api, data);
+}
+
class Game extends React.Component {
constructor(props) {
super(props);
class Game extends React.Component {
constructor(props) {
super(props);