refactor: Follow up handle logout and login with new client
This commit is contained in:
parent
2ba5b1170d
commit
2616ba6e4b
5 changed files with 26 additions and 15 deletions
|
|
@ -44,13 +44,17 @@ abstract class AppRoutes {
|
|||
BuildContext context,
|
||||
GoRouterState state,
|
||||
) =>
|
||||
Matrix.of(context).client.isLogged() ? '/rooms' : null;
|
||||
Matrix.of(context).widget.clients.any((client) => client.isLogged())
|
||||
? '/rooms'
|
||||
: null;
|
||||
|
||||
static FutureOr<String?> loggedOutRedirect(
|
||||
BuildContext context,
|
||||
GoRouterState state,
|
||||
) =>
|
||||
Matrix.of(context).client.isLogged() ? null : '/home';
|
||||
Matrix.of(context).widget.clients.any((client) => client.isLogged())
|
||||
? null
|
||||
: '/home';
|
||||
|
||||
AppRoutes();
|
||||
|
||||
|
|
@ -58,7 +62,9 @@ abstract class AppRoutes {
|
|||
GoRoute(
|
||||
path: '/',
|
||||
redirect: (context, state) =>
|
||||
Matrix.of(context).client.isLogged() ? '/rooms' : '/home',
|
||||
Matrix.of(context).widget.clients.any((client) => client.isLogged())
|
||||
? '/rooms'
|
||||
: '/home',
|
||||
),
|
||||
GoRoute(
|
||||
path: '/home',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue