reactjs - How to dispatch action from a child window? -


i have implemented custom sso service, works fine open popup request user authorization instead of redirect him page.

the problem is, when user has accepted or refused connect account, need refresh parent window (the web app) , close popup (authorization).

so thinking dispatching action popup parent window refresh state, like:

componentwillmount() {   window.opener.loginsuccess(this.props.user); } 

but don't see action window object. how implement feature?

you can add opener window reference loginsuccess method dispatch needed wanted action:

const store = redux.createstore(reducer); window.loginsuccess = function(user) {     store.dispatch(sampleactioncreator(user)); }; 

now can access window.opener.loginsuccess() child.


Comments