2015-08-26 09:50:38 +02:00
|
|
|
'use strict';
|
|
|
|
|
2015-10-06 16:47:59 +02:00
|
|
|
import { alt } from '../alt';
|
2015-08-26 09:50:38 +02:00
|
|
|
import OwnershipActions from '../actions/ownership_actions';
|
|
|
|
|
|
|
|
|
|
|
|
class OwnershipStore {
|
|
|
|
constructor() {
|
|
|
|
this.loanRequestList = [];
|
|
|
|
this.loanRequest = null;
|
|
|
|
this.bindActions(OwnershipActions);
|
|
|
|
}
|
|
|
|
|
|
|
|
onUpdateLoanPieceRequestList(loanRequests) {
|
|
|
|
this.loanRequestList = loanRequests;
|
|
|
|
}
|
|
|
|
|
|
|
|
onUpdateLoanPieceRequest({loanRequests, pieceId}) {
|
|
|
|
this.loanRequestList = loanRequests;
|
|
|
|
this.loanRequest = loanRequests.filter((item) => item.piece_id === pieceId.toString());
|
|
|
|
if (this.loanRequest.length > 0){
|
|
|
|
this.loanRequest = this.loanRequest[0];
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
this.loanRequest = null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-08-26 15:46:27 +02:00
|
|
|
onFlushLoanPieceRequest(){
|
2015-08-26 09:50:38 +02:00
|
|
|
this.loanRequestList = [];
|
|
|
|
this.loanRequest = null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default alt.createStore(OwnershipStore, 'OwnershipStore');
|