javascript - Redux-Saga not able to correctly read response from fetch api -


hi how read data coming fetch call:

export function* fetchmessages(channel) {          yield put(requestmessages())     const channel_name = channel.payload     try {               const response = yield call(fetch,'/api/messages/'+channel_name)          const res = response.json()             console.log(res)         yield put(receivemessages(res,channel))      } catch (error){              yield put(rejectmessages(error))    }       }      

when console.log(res) get:

promise {[[promisestatus]]: "pending", [[promisevalue]]: undefined} __proto__ : promise [[promisestatus]] : "resolved" [[promisevalue]] : array[7] 

how "info" (side array[7] promise? new this. thanks

response.json() async , returns promise

change

const res = response.json() 

to

const res = yield response.json() 

webpackbin example


Comments

Popular posts from this blog

amazon web services - S3 Pre-signed POST validate file type? -

c# - Check Keyboard Input Winforms -