Closed srobertson421 closed 5 years ago
Hey thanks for your issue. I have a few examples below illustrating how to achieve what you're trying to. Let me know if you have any questions. Happy for me to close this issue?
Simple example (sync): https://codesandbox.io/s/weathered-cdn-goup2
Example with stores (async): https://codesandbox.io/s/vigorous-satoshi-z3jyv
Example with stores + groups: https://codesandbox.io/s/old-river-6l852
@alshdavid Those are great, thanks! I think I was running into issues due to load order, I had other .use calls before the auth middleware, moved it and it's working great.
Is your feature request related to a problem? Please describe. Trying to add protected routes based on async auth data. Redirects don't prevent other routes from matching and rendering.
Describe the solution you'd like Using the middleware option, be able to prevent rendering of predefined routes by using redirect or a separate mount call.
Additional context Here is my router code, the middleware I have above isn't preventing other routes from rendering: