import types from '../types' const datasetInitialState = { loading: false, error: null, status: '', } const datasetReducer = (state = datasetInitialState, action) => { switch(action.type) { case types.folder.upload_loading: return { error: null, loading: true, status: 'Loading...', } case types.folder.upload_error: return { error: null, loading: false, status: 'Error uploading :(', } case types.folder.upload_progress: return { error: null, loading: true, status: 'Upload progress ' + action.percent + '%', } case types.folder.upload_waiting: return { error: null, loading: true, status: 'Waiting for server to finish processing...', } case types.file.create_loading: return { error: null, loading: true, status: 'Creating file...' } case types.socket.status: return datasetSocket(state, action.data) default: return state } } const datasetSocket = (state, action) => { console.log(action) switch (action.key) { default: return state } } export default datasetReducer