1
0
mirror of https://github.com/ascribe/onion.git synced 2025-01-03 10:25:08 +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); .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() { delete() {
requests requests
.delete(this.props.url, this.getFormData()) .delete(this.props.url, this.getFormData())

View File

@ -50,8 +50,9 @@ let ContractAgreementForm = React.createClass({
this.setState({selectedContract: event.target.selectedIndex}); this.setState({selectedContract: event.target.selectedIndex});
}, },
handleSubmitSuccess(response) { handleSubmitSuccess() {
let notification = new GlobalNotificationModel(response.notification, 'success', 10000); let notification = 'Contract agreement send';
notification = new GlobalNotificationModel(notification, 'success', 10000);
GlobalNotificationActions.appendGlobalNotification(notification); GlobalNotificationActions.appendGlobalNotification(notification);
}, },
@ -62,7 +63,6 @@ let ContractAgreementForm = React.createClass({
getContracts() { getContracts() {
if (this.state.contractList && this.state.contractList.length > 0) { if (this.state.contractList && this.state.contractList.length > 0) {
let contractList = this.state.contractList; let contractList = this.state.contractList;
console.log(contractList)
return ( return (
<Property <Property
name='contract' name='contract'
@ -100,7 +100,7 @@ let ContractAgreementForm = React.createClass({
ref='form' ref='form'
url={ApiUrls.ownership_contract_agreements} url={ApiUrls.ownership_contract_agreements}
getFormData={this.getFormData} getFormData={this.getFormData}
handleSuccess={this.props.handleSuccess} handleSuccess={this.handleSubmitSuccess}
buttons={<button buttons={<button
type="submit" type="submit"
className="btn ascribe-btn ascribe-btn-login"> className="btn ascribe-btn ascribe-btn-login">

View File

@ -128,6 +128,7 @@ let IkonotvContractNotifications = React.createClass({
ref='form' ref='form'
url={requests.prepareUrl(apiUrls.ownership_contract_agreements_confirm, {contract_agreement_id: contractAgreement.id})} url={requests.prepareUrl(apiUrls.ownership_contract_agreements_confirm, {contract_agreement_id: contractAgreement.id})}
handleSuccess={this.handleConfirmSuccess} handleSuccess={this.handleConfirmSuccess}
method='put'
buttons={ buttons={
<p style={{marginTop: '1em'}}> <p style={{marginTop: '1em'}}>
<Button type="submit">{getLangText('I agree with the conditions')}</Button> <Button type="submit">{getLangText('I agree with the conditions')}</Button>

View File

@ -157,6 +157,10 @@ class Requests {
return this._putOrPost(url, params, 'put'); return this._putOrPost(url, params, 'put');
} }
patch(url, params){
return this._putOrPost(url, params, 'patch');
}
defaults(options) { defaults(options) {
this.httpOptions = options.http || {}; this.httpOptions = options.http || {};
this.urlMap = options.urlMap || {}; this.urlMap = options.urlMap || {};