1
0
mirror of https://github.com/ascribe/onion.git synced 2024-11-15 01:25:17 +01:00

contractagreement with PUT instead of PATCH

This commit is contained in:
diminator 2015-09-09 13:53:03 +02:00
parent 17f7be9257
commit ec2ae39e15
4 changed files with 23 additions and 4 deletions

View File

@ -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())

View File

@ -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 (
<Property
name='contract'
@ -100,7 +100,7 @@ let ContractAgreementForm = React.createClass({
ref='form'
url={ApiUrls.ownership_contract_agreements}
getFormData={this.getFormData}
handleSuccess={this.props.handleSuccess}
handleSuccess={this.handleSubmitSuccess}
buttons={<button
type="submit"
className="btn ascribe-btn ascribe-btn-login">

View File

@ -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={
<p style={{marginTop: '1em'}}>
<Button type="submit">{getLangText('I agree with the conditions')}</Button>

View File

@ -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 || {};