I am having some difficulties with redux-saga. I have the following saga:
createPostSaga:
function* createPostSaga(action) {
const token = yield select(selectToken);
const headerParams = {
Authorization: `JWT ${token}`
};
console.log(token, headerParams);
try {
yield call(axios.post, "/posts/", action.payload, headerParams);
yield call(getPosts());
} catch (error) {
console.log(error);
}
}
As you can see I am selecting my token, and putting into an object with key Authorization and value JWT ${token}, my API is still responding with 401 unauthorized, but it must be an issue with this call because I can replicate this call in Postman and it goes through fine:
Does anyone see what I did wrong?
