import types from '../../types' import datasetReducer from '../../dataset/dataset.reducer' const bigganInitialState = { loading: true, progress: { i: 0, n: 0 }, error: null, folder_id: 0, data: null, results: null, checkpoint: { name: '', sequenceCount: 0, datasetCount: 0, } } const bigganReducer = (state = bigganInitialState, action) => { if (action.data && action.data.module === 'biggan') { state = datasetReducer(state, action) } switch (action.type) { case types.biggan.load_results: return { ...state, results: action.results, } case types.file.destroy: console.log('file destroy', state.results) return { ...state, results: { ...state.results, files: state.results.files.filter(f => f.id !== action.data.id) } } default: return state } } export default bigganReducer