Closed carmas123 closed 2 months ago
Description I try to use redirect into Router but when I try to use it I got always an exception.
redirect
Router
Steps To Reproduce
Simply add a redirect to a base app created with Jaspr-CLI, like this:
@override Iterable<Component> build(BuildContext context) sync* { yield div(classes: 'main', [ const Header(), Router( routes: [ Route( path: '/', title: 'Home', builder: (context, state) => const Home()), Route( path: '/about', title: 'About', builder: (context, state) => const About()), ], redirect: (context, state) => "/", ), ]); }
With this I try to redirect all to home page and I got this when I try to navigate into /about path:
[SERVER] [ERROR] ERROR - 2024-04-06 01:04:59.690111 [SERVER] [ERROR] [SERVER] [ERROR] GET /about [SERVER] [ERROR] Error thrown by handler. [SERVER] [ERROR] UnimplementedError: Routing unavailable on the server [SERVER] [ERROR] package:jaspr_router/src/platform/platform_server.dart 24:5 HistoryManagerImpl.replace [SERVER] [ERROR] package:jaspr_router/src/router.dart 102:41 RouterState.initRoutes.<fn>
Oh I see, that error should only come when trying to do Router.push() from the server, but not for resirects
This is now fixed on main. Will be part of the next release.
Description I try to use
redirect
intoRouter
but when I try to use it I got always an exception.Steps To Reproduce
Simply add a redirect to a base app created with Jaspr-CLI, like this:
With this I try to redirect all to home page and I got this when I try to navigate into /about path: