I have this code in sagas.js
.
import { put, takeLatest } from "redux-saga/effects";
import { getArticles } from "../scripts/resources/articles";
import { GET_ARTICLES, SHOW_MATCHES } from "./constants";
function getMatches(action) {
const { searchValue } = action;
getArticles(searchValue, (matches) => {
console.log(matches)
put({ type: SHOW_MATCHES, payload: matches })
})
}
export default function* rootSaga() {
yield takeLatest(GET_MATCHES, getMatches);
}
And this is the getArticles
function.
export function getArticles(input, callBack) {
setTimeout(() => {
callBack(filterArticles(input));
}, 300);
};
The put inside the callback does not actually dispatch the action as I don't reach the case in the reducer. How can I dispatch this action?