Redux how to open a new window after ajax complete
<p>Here is my problem:</p>

<p>I have a save button on a form. When the save button is clicked, it should sent the form data via ajax. When the ajax call succeeded, a new window should be opened.</p>

<p>The issue I run into is this (I am using React + Redux):</p>

<pre class="lang-js prettyprint-override"><code>//inside the component class
handleSubmit = (e) =&gt; {
    this.props.dispatch( // calls ajax )
}


//inside the ajax action
dispatch =&gt; {
    fetch(...).then(response =&gt; {
        if (res.status &gt;= 200 &amp;&amp; res.status &lt; 300) {
            window.open(...)
        }
    })
}
</code></pre>

<p>The problem with putting <code>window.open()</code> inside ajax calls is that the new window will be considered as pop-ups which are blocked by chrome and FF.</p>

<p>I think I should put <code>window.open()</code> inside <code>handleSubmit</code> to prevent browsers from blocking it. But how can I determine if <code>dispatch</code> has completed successfully inside <code>handleSubmit</code>? or is there any other places that I can call <code>window.open()</code> without being blocked?</p>