URL redirect && `dispatch` to return promise
See original GitHub issueI am trying to think of a way to do redirection. Here are some examples, of which one requires dispatch to return promise.
// Redirect / to /home
{on("/", async() => {
const {state, component} = await this.dispatch("/home");
return component;
})}
Or provide a new api redirect
(same level as on
)?
redirct("/", "/home");
Apparently second one is better. Maybe adding this will be good?
<bountysource-plugin> --- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/31733774-url-redirect-dispatch-to-return-promise?utm_campaign=plugin&utm_content=tracker%2F18115217&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F18115217&utm_medium=issues&utm_source=github). </bountysource-plugin>Issue Analytics
- State:
- Created 8 years ago
- Reactions:1
- Comments:7 (3 by maintainers)
Top Results From Across the Web
How to Transition to Another Route on Successful Async ...
In this guide, we will use a Redux action to redirect the user using the <Redirect /> component. We will dispatch an action...
Read more >Returning a dispatch with promises in action creators of react ...
Your first approach was mostly correct. dispatch(thunkAction()) (or in your case this.props.actions.login() returns whatever thunkAction() ...
Read more >Reactjs – Redux – Change URL when an async action is dispatched ...
Meaning, upon success, the users is "redirected" to another URL (route) the displays a ... userId) { return Promise.all( loadSomeData(dispatch, userId), ...
Read more >useHooks - Easy to understand React Hook recipes
We bring you easy to understand React Hook code recipes so you can learn how React hooks work and feel more comfortable writing...
Read more >Node.js Undici
A HTTP/1.1 client, written from scratch for Node.js. ... Returns a promise with the result of the Dispatcher.request method.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
What do you think about this API? Where a route with redirect looks like this:
Another example, when you need to do some async stuff before doing a redirect:
@JeongTaekLim answer regarding your error: https://github.com/kriasoft/universal-router/issues/127#issuecomment-332552740
Docs about redirects added. Closing.