Theory regarding working of call() is well explained on many websites. However, I did not found any site which explains accurately with proper working example.
I have written following code:
export function* loadUser() {
try {
const user = yield call(getUser);
yield put({type: 'FETCH_USER_SUCCESS', payload: user});
} catch(error) {
yield put({type: 'FETCH_FAILED', error});
}
}
here, I want to send 'get' request with some parameters and some header using call() .But I don't know how to achieve it. Please, if you have time, tell it with proper working example(Codepen or jsFiddle).