2017-07-11 17:37:43 +02:00
|
|
|
import * as ActionTypes from '../../../constants';
|
|
|
|
|
2019-07-24 18:55:58 +02:00
|
|
|
// 1,000,000 bytes in a MB. can't upload if totalSize is bigger than this.
|
|
|
|
const initialState = {
|
2019-09-11 00:42:23 +02:00
|
|
|
list: []
|
2019-07-24 18:55:58 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
const assets = (state = initialState, action) => {
|
2017-07-11 17:37:43 +02:00
|
|
|
switch (action.type) {
|
|
|
|
case ActionTypes.SET_ASSETS:
|
2019-09-11 00:42:23 +02:00
|
|
|
return { list: action.assets };
|
|
|
|
case ActionTypes.DELETE_ASSET:
|
|
|
|
return { list: state.list.filter(asset => asset.key !== action.key) };
|
2017-07-11 17:37:43 +02:00
|
|
|
default:
|
|
|
|
return state;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
export default assets;
|