diff options
Diffstat (limited to 'app/client/browser/browser.reducer.js')
| -rw-r--r-- | app/client/browser/browser.reducer.js | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/app/client/browser/browser.reducer.js b/app/client/browser/browser.reducer.js new file mode 100644 index 0000000..099176f --- /dev/null +++ b/app/client/browser/browser.reducer.js @@ -0,0 +1,40 @@ +import types from '../types' + +import moment from 'moment/min/moment.min' +let FileSaver = require('file-saver') + +const browserInitialState = { + loading: false, + progress: null, + error: null, + data: {}, + images: [ + ], + files: [ + ] +} + +const browserReducer = (state = browserInitialState, action) => { + switch(action.type) { + case types.app.load_progress: + if (!action.data || action.data.module !== 'browser') { + return state + } + return { + ...state, + loading: true, + progress: action.progress, + } + case types.app.load: + return { + ...state, + loading: false, + error: null, + data: action.data, + } + default: + return state + } +} + +export default browserReducer |
