Dva: effects里面的方法可以互相调用吗

Created on 7 Nov 2016  ·  5Comments  ·  Source: dvajs/dva

例如
{ ..., effects:{ *auth(), *login(){ yield response = call(auth,action,{put}) .... } } }
如果要调用effect里面的方法,得怎么写

question

Most helpful comment

@sorrycc 请问如何在effect里同步等待另一个effect的完成?

All 5 comments

两个方案:

  1. 通过 put action 去调? yield put({ type: 'auth' });,缺点是不会等待完成
  2. auth 抽到 model 外,然后在 effect 里用 yiled * 去调他

我现在就是使用你第二种方法,谢谢你这么及时回复

@sorrycc 请问如何在effect里同步等待另一个effect的完成?

还可以yield take('auth/@@end')

还可以yield take('auth/@@EnD')

可行,好办法

Was this page helpful?
0 / 5 - 0 ratings