Commit 1ed254f

mo khan <mo@mokhan.ca>
2017-01-14 17:24:22
inline success.
1 parent e293475
Changed files (1)
app
infrastructure
app/infrastructure/api.js
@@ -14,17 +14,20 @@ export default class Api {
 
   post(relativeUrl, body, success) {
     const url = this.buildUrlFor(relativeUrl);
-    const jsonBody = JSON.stringify(body);
     this.defaultHeaders((headers) => {
       console.log(`POST ${url}`);
-      this.execute(url, { method: "POST", headers: headers, body: jsonBody }, success);
+      this.execute(url, {
+        method: "POST",
+        headers: headers,
+        body: JSON.stringify(body)
+      }, success);
     });
   }
 
   execute(url, options, success) {
     fetch(url, options)
       .then((response) => response.json())
-      .then((json) => success(json))
+      .then(success)
       .catch((error) => console.error(error))
       .done();
   }