Remove updateEntity method from Api
authorFrank Bessou <frank.bessou@logilab.fr>
Fri, 28 Apr 2017 16:59:28 +0200
changeset 163 3fa4f698fb32
parent 162 1960d7fa8edf
child 164 9edd5ed68ae1
Remove updateEntity method from Api Use updateResource from HypermediaClient instead.
src/Api.js
src/components/Entity.js
--- a/src/Api.js	Fri Apr 28 16:42:00 2017 +0200
+++ b/src/Api.js	Fri Apr 28 16:59:28 2017 +0200
@@ -89,11 +89,6 @@
         return this.hypermediaClient.jsonFetch(url, options);
     }
 
-    updateEntity(etype, eid, attributes) {
-        const url = `/${etype}/${eid}`;
-        return this.hypermediaClient.updateResource(url, attributes);
-    }
-
     getTransitionsSchema(etype, eid) {
         const url = `/${etype}/${eid}/transitions/schema?role=creation`;
         return this.hypermediaClient.jsonSchemaFetch(url);
--- a/src/components/Entity.js	Fri Apr 28 16:42:00 2017 +0200
+++ b/src/components/Entity.js	Fri Apr 28 16:59:28 2017 +0200
@@ -477,8 +477,8 @@
     }
 
     onSubmit({formData}) {
-        const {etype, eid} = this.props.entity;
-        Api.updateEntity(etype, eid, formData)
+        const url = this.props.entity.route;
+        HypermediaClient.updateResource(url, formData)
             .then(entity => {
                 this.props.updateEntity(entity);
                 this.context.router.history.push(this.props.redirectPath);