Reputation: 328
I'm new to redux-saga and i get this 'Promise {: undefined}proto: Promise[[PromiseStatus]]: "resolved"[[PromiseValue]]: undefined' I just want a simple example to get running first thanks
Tried searching but have not found anything useful
function* fetcFunction() {
try {
const request = yield
axios.get(`https://jsonplaceholder.typicode.com/todos/1`)
yield put(test(request));
} catch (e) {
console.log(e);
}
}
function* Watcher() {
yield takeLatest(FETCH_JSON, fetcFunction);
}
export default Watcher;
I expect to get a data.
Upvotes: 0
Views: 52
Reputation: 516
You should use call
for api requests:
const request = yield call(axios.get, 'https://jsonplaceholder.typicode.com/todos/1')
Upvotes: 1