mirror of
https://github.com/ascribe/onion.git
synced 2024-12-22 17:33:14 +01:00
39 lines
1.0 KiB
JavaScript
39 lines
1.0 KiB
JavaScript
'use strict';
|
|
|
|
import { alt } from '../alt';
|
|
import OwnershipFetcher from '../fetchers/ownership_fetcher';
|
|
|
|
|
|
class OwnershipActions {
|
|
constructor() {
|
|
this.generateActions(
|
|
'updateLoanPieceRequestList',
|
|
'updateLoanPieceRequest',
|
|
'flushLoanPieceRequest'
|
|
);
|
|
}
|
|
|
|
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});
|
|
})
|
|
.catch((err) => {
|
|
console.logGlobal(err);
|
|
});
|
|
}
|
|
}
|
|
|
|
export default alt.createActions(OwnershipActions);
|