From ec2ae39e15565bbfe1ed52fad2759e89b55cbae0 Mon Sep 17 00:00:00 2001 From: diminator Date: Wed, 9 Sep 2015 13:53:03 +0200 Subject: [PATCH] contractagreement with PUT instead of PATCH --- js/components/ascribe_forms/form.js | 14 ++++++++++++++ .../ascribe_forms/form_contract_agreement.js | 8 ++++---- .../ikonotv/ikonotv_contract_notifications.js | 1 + js/utils/requests.js | 4 ++++ 4 files changed, 23 insertions(+), 4 deletions(-) diff --git a/js/components/ascribe_forms/form.js b/js/components/ascribe_forms/form.js index d0117251..16ad4020 100644 --- a/js/components/ascribe_forms/form.js +++ b/js/components/ascribe_forms/form.js @@ -93,6 +93,20 @@ let Form = React.createClass({ .catch(this.handleError); }, + put() { + requests + .put(this.props.url, { body: this.getFormData() }) + .then(this.handleSuccess) + .catch(this.handleError); + }, + + patch() { + requests + .patch(this.props.url, { body: this.getFormData() }) + .then(this.handleSuccess) + .catch(this.handleError); + }, + delete() { requests .delete(this.props.url, this.getFormData()) diff --git a/js/components/ascribe_forms/form_contract_agreement.js b/js/components/ascribe_forms/form_contract_agreement.js index c2f2b810..9aad8827 100644 --- a/js/components/ascribe_forms/form_contract_agreement.js +++ b/js/components/ascribe_forms/form_contract_agreement.js @@ -50,8 +50,9 @@ let ContractAgreementForm = React.createClass({ this.setState({selectedContract: event.target.selectedIndex}); }, - handleSubmitSuccess(response) { - let notification = new GlobalNotificationModel(response.notification, 'success', 10000); + handleSubmitSuccess() { + let notification = 'Contract agreement send'; + notification = new GlobalNotificationModel(notification, 'success', 10000); GlobalNotificationActions.appendGlobalNotification(notification); }, @@ -62,7 +63,6 @@ let ContractAgreementForm = React.createClass({ getContracts() { if (this.state.contractList && this.state.contractList.length > 0) { let contractList = this.state.contractList; - console.log(contractList) return ( diff --git a/js/components/whitelabel/wallet/components/ikonotv/ikonotv_contract_notifications.js b/js/components/whitelabel/wallet/components/ikonotv/ikonotv_contract_notifications.js index db369564..274eea5c 100644 --- a/js/components/whitelabel/wallet/components/ikonotv/ikonotv_contract_notifications.js +++ b/js/components/whitelabel/wallet/components/ikonotv/ikonotv_contract_notifications.js @@ -128,6 +128,7 @@ let IkonotvContractNotifications = React.createClass({ ref='form' url={requests.prepareUrl(apiUrls.ownership_contract_agreements_confirm, {contract_agreement_id: contractAgreement.id})} handleSuccess={this.handleConfirmSuccess} + method='put' buttons={

diff --git a/js/utils/requests.js b/js/utils/requests.js index 459cd480..b36351a2 100644 --- a/js/utils/requests.js +++ b/js/utils/requests.js @@ -157,6 +157,10 @@ class Requests { return this._putOrPost(url, params, 'put'); } + patch(url, params){ + return this._putOrPost(url, params, 'patch'); + } + defaults(options) { this.httpOptions = options.http || {}; this.urlMap = options.urlMap || {};