Answer the question
In order to leave comments, you need to log in
How to combine several reducers into one?
There are two reducers, you need to get one. How to do it?
import * as constants from '../constants';
const initialState = [];
export function queryLog(state = initialState, action): object {
if (action.type === constants.LOAD_QUERY_LOG_STOP) {
action.queryLog.forEach(e => {
if ('dt_changelog' in e) {
e['dt_changelog'] = e.dt_changelog * 1000;
}
});
return action.queryLog;
}
return state;
}
import * as constants from '../constants';
const initialState = [];
export function comments(state = initialState, action): object {
if (action.type === constants.LOAD_COMMENTS_STOP || action.type === constants.SENT_COMMENT) {
action.comments.forEach(e => {
if ('datetime' in e) {
e.datetime = e.datetime * 1000;
}
});
return action.comments;
}
return state;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question