Yield inside .then function of promise response throws error

Viewed 3163

Following code is throwing error:

  syncData().then((x) => yield put(loginUserSuccess(responseData)));

Error: The keyword 'yield' is reserved.

Sync data handles asynchronous operations of fetching data.I want to use yield put(provided by sagas.js) to trigger the action login user success after sync data has been performed.

Core of syncData function is as follows:

  export default async function syncData(dataType) {
      await Promise.all([syncData1(), syncData2()]);
  }
1 Answers
Related