SHARE
TWEET

Untitled

a guest Sep 17th, 2019 94 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* ***********************************************************
  2. * A short word on how to use this automagically generated file.
  3. * We're often asked in the ignite gitter channel how to connect
  4. * to a to a third party api, so we thought we'd demonstrate - but
  5. * you should know you can use sagas for other flow control too.
  6. *
  7. * Other points:
  8. *  - You'll need to add this saga to sagas/index.js
  9. *  - This template uses the api declared in sagas/index.js, so
  10. *    you'll need to define a constant in that file.
  11. *************************************************************/
  12.  
  13. import { call, put } from 'redux-saga/effects'
  14. import DompetInpoinActions from '../Redux/DompetInpoinRedux'
  15. // import { DompetInpoinSelectors } from '../Redux/DompetInpoinRedux'
  16.  
  17. export function * getDompetInpoin (api, action) {
  18.   try {
  19.     const { data } = action
  20.   // get current data from Store
  21.   // const currentData = yield select(DompetInpoinSelectors.getData)
  22.   // make the call to the api
  23.   const response = yield call(api.getDompetInpoin, data)
  24.  
  25.   // success?
  26.   if (response.ok) {
  27.     // You might need to change the response here - do this with a 'transform',
  28.     // located in ../Transforms/. Otherwise, just pass the data back from the api.
  29.     yield put(DompetInpoinActions.dompetInpoinSuccess(response.data))
  30.   } else {
  31.     yield put(DompetInpoinActions.dompetInpoinFailure())
  32.   }
  33.   } catch (error) {
  34.     console.log({error})
  35.   }
  36. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top