1
0
mirror of https://github.com/ascribe/onion.git synced 2024-12-22 09:23:13 +01:00
onion/js/actions/ownership_actions.js

39 lines
1.0 KiB
JavaScript
Raw Normal View History

2015-08-26 09:50:38 +02:00
'use strict';
import { alt } from '../alt';
2015-08-26 09:50:38 +02:00
import OwnershipFetcher from '../fetchers/ownership_fetcher';
class OwnershipActions {
constructor() {
this.generateActions(
'updateLoanPieceRequestList',
'updateLoanPieceRequest',
'flushLoanPieceRequest'
2015-08-26 09:50:38 +02:00
);
}
fetchLoanRequestList() {
OwnershipFetcher.fetchLoanPieceRequestList()
.then((data) => {
this.actions.updateLoanPieceRequestList(data.loan_requests);
})
.catch((err) => {
console.logGlobal(err);
this.actions.updateLoanPieceRequestList(null);
});
}
fetchLoanRequest(pieceId) {
OwnershipFetcher.fetchLoanPieceRequestList()
.then((data) => {
this.actions.updateLoanPieceRequest({loanRequests: data.loan_requests, pieceId: pieceId});
2015-08-26 09:50:38 +02:00
})
.catch((err) => {
console.logGlobal(err);
});
}
}
export default alt.createActions(OwnershipActions);