freeCodeCamp/client/sagas/hard-go-to-saga.js

11 lines
317 B
JavaScript

import { hardGoTo } from '../../common/app/redux/types';
export default function hardGoToSaga(action$, getState, { history }) {
return action$
.filter(({ type }) => type === hardGoTo)
.map(({ payload = '/settings' }) => {
history.pushState(history.state, null, payload);
return null;
});
}