add claim to claimsByUri after claim_list_mine
This commit is contained in:
parent
aa10240bc1
commit
d6f7ac731d
2 changed files with 15 additions and 0 deletions
8
dist/bundle.js
vendored
8
dist/bundle.js
vendored
|
@ -5192,6 +5192,8 @@ var _action_types = __webpack_require__(4);
|
|||
|
||||
var ACTIONS = _interopRequireWildcard(_action_types);
|
||||
|
||||
var _lbryURI = __webpack_require__(2);
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
|
||||
|
||||
var reducers = {};
|
||||
|
@ -5263,15 +5265,20 @@ reducers[ACTIONS.FETCH_CLAIM_LIST_MINE_COMPLETED] = function (state, action) {
|
|||
var claims = action.data.claims;
|
||||
|
||||
var byId = Object.assign({}, state.byId);
|
||||
var byUri = Object.assign({}, state.claimsByUri);
|
||||
var pendingById = Object.assign({}, state.pendingById);
|
||||
|
||||
claims.forEach(function (claim) {
|
||||
var uri = (0, _lbryURI.buildURI)({ claimName: claim.name, claimId: claim.claim_id });
|
||||
|
||||
if (claim.type && claim.type.match(/claim|update/)) {
|
||||
if (claim.confirmations < 1) {
|
||||
pendingById[claim.claim_id] = claim;
|
||||
delete byId[claim.claim_id];
|
||||
delete byUri[claim.claim_id];
|
||||
} else {
|
||||
byId[claim.claim_id] = claim;
|
||||
byUri[uri] = claim.claim_id;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -5287,6 +5294,7 @@ reducers[ACTIONS.FETCH_CLAIM_LIST_MINE_COMPLETED] = function (state, action) {
|
|||
isFetchingClaimListMine: false,
|
||||
myClaims: claims,
|
||||
byId: byId,
|
||||
claimsByUri: byUri,
|
||||
pendingById: pendingById
|
||||
});
|
||||
};
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import * as ACTIONS from 'constants/action_types';
|
||||
import { buildURI } from 'lbryURI';
|
||||
|
||||
const reducers = {};
|
||||
|
||||
|
@ -52,15 +53,20 @@ reducers[ACTIONS.FETCH_CLAIM_LIST_MINE_STARTED] = (state) =>
|
|||
reducers[ACTIONS.FETCH_CLAIM_LIST_MINE_COMPLETED] = (state, action) => {
|
||||
const { claims } = action.data;
|
||||
const byId = Object.assign({}, state.byId);
|
||||
const byUri = Object.assign({}, state.claimsByUri);
|
||||
const pendingById = Object.assign({}, state.pendingById);
|
||||
|
||||
claims.forEach((claim) => {
|
||||
const uri = buildURI({ claimName: claim.name, claimId: claim.claim_id });
|
||||
|
||||
if (claim.type && claim.type.match(/claim|update/)) {
|
||||
if (claim.confirmations < 1) {
|
||||
pendingById[claim.claim_id] = claim;
|
||||
delete byId[claim.claim_id];
|
||||
delete byUri[claim.claim_id];
|
||||
} else {
|
||||
byId[claim.claim_id] = claim;
|
||||
byUri[uri] = claim.claim_id;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -76,6 +82,7 @@ reducers[ACTIONS.FETCH_CLAIM_LIST_MINE_COMPLETED] = (state, action) => {
|
|||
isFetchingClaimListMine: false,
|
||||
myClaims: claims,
|
||||
byId,
|
||||
claimsByUri: byUri,
|
||||
pendingById,
|
||||
});
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue