Dva: How to access history in effects?

Created on 14 Nov 2016  ·  8Comments  ·  Source: dvajs/dva

question

Most helpful comment

push history in effect? try this.

import { routerRedux } from 'dva/router';

// Inside Effects
yield put(routerRedux.push('/logout'));

All 8 comments

@sorrycc

What property of history do you want to access?

@sorrycc router history

const routing = yield select(state => state.routing);

image

exactly i want to access the history.push api,
but I can only get a location obj by selecting the "routing" state in store
so..... any other solutions?

push history in effect? try this.

import { routerRedux } from 'dva/router';

// Inside Effects
yield put(routerRedux.push('/logout'));

thx a lot!

Need to make a list of these tickets on dvajs homepage.

Was this page helpful?
0 / 5 - 0 ratings