add download canceled to the file_info reducer #86

Merged
akinwale merged 1 commit from download-canceled into master 2018-10-23 16:53:55 +02:00
2 changed files with 23 additions and 0 deletions
dist
src/redux/reducers

12
dist/bundle.js vendored
View file

@ -5469,6 +5469,18 @@ reducers[ACTIONS.DOWNLOADING_PROGRESSED] = function (state, action) {
});
};
reducers[ACTIONS.DOWNLOADING_CANCELED] = function (state, action) {
var outpoint = action.data.outpoint;
var newDownloading = Object.assign({}, state.downloadingByOutpoint);
delete newDownloading[outpoint];
return Object.assign({}, state, {
downloadingByOutpoint: newDownloading
});
};
reducers[ACTIONS.DOWNLOADING_COMPLETED] = function (state, action) {
var _action$data4 = action.data,
outpoint = _action$data4.outpoint,

View file

@ -85,6 +85,17 @@ reducers[ACTIONS.DOWNLOADING_PROGRESSED] = (state, action) => {
});
};
reducers[ACTIONS.DOWNLOADING_CANCELED] = (state, action) => {
const { outpoint } = action.data;
const newDownloading = Object.assign({}, state.downloadingByOutpoint);
delete newDownloading[outpoint];
return Object.assign({}, state, {
skhameneh commented 2018-10-23 05:41:08 +02:00 (Migrated from github.com)

Can also use:

return {
  ...state,
  {
    downloadingByOutpoint: newDownloading
  }
}
Can also use: ``` return { ...state, { downloadingByOutpoint: newDownloading } } ```
downloadingByOutpoint: newDownloading,
});
};
reducers[ACTIONS.DOWNLOADING_COMPLETED] = (state, action) => {
const { outpoint, fileInfo } = action.data;