Fix missing redirect after login
This commit is contained in:
		@@ -1,10 +1,11 @@
 | 
			
		||||
import 'package:moneymgr_mobile/services/api/api_client.dart';
 | 
			
		||||
import 'package:moneymgr_mobile/services/api/api_token.dart';
 | 
			
		||||
import 'package:moneymgr_mobile/services/api/auth_api.dart';
 | 
			
		||||
import 'package:moneymgr_mobile/services/router/routes_list.dart';
 | 
			
		||||
import 'package:moneymgr_mobile/services/storage/secure_storage.dart';
 | 
			
		||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
 | 
			
		||||
 | 
			
		||||
import '../services/router/routes_list.dart';
 | 
			
		||||
 | 
			
		||||
part 'auth_state.g.dart';
 | 
			
		||||
 | 
			
		||||
/// The current authentication state of the app.
 | 
			
		||||
@@ -27,7 +28,7 @@ class CurrentAuthState extends _$CurrentAuthState {
 | 
			
		||||
    await ApiClient(token: token).authInfo();
 | 
			
		||||
 | 
			
		||||
    final secureStorage = ref.read(secureStorageProvider).requireValue;
 | 
			
		||||
    secureStorage.setToken(token);
 | 
			
		||||
    await secureStorage.setToken(token);
 | 
			
		||||
 | 
			
		||||
    ref
 | 
			
		||||
        // Invalidate the state so the auth state will be updated to authenticated.
 | 
			
		||||
 
 | 
			
		||||
@@ -1,11 +1,13 @@
 | 
			
		||||
import 'package:flutter/material.dart';
 | 
			
		||||
import 'package:flutter_gutter/flutter_gutter.dart';
 | 
			
		||||
import 'package:flutter_hooks/flutter_hooks.dart';
 | 
			
		||||
import 'package:go_router/go_router.dart';
 | 
			
		||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
 | 
			
		||||
import 'package:logging/logging.dart';
 | 
			
		||||
import 'package:moneymgr_mobile/providers/auth_state.dart';
 | 
			
		||||
import 'package:moneymgr_mobile/routes/login/base_auth_page.dart';
 | 
			
		||||
import 'package:moneymgr_mobile/services/api/api_token.dart';
 | 
			
		||||
import 'package:moneymgr_mobile/providers/auth_state.dart';
 | 
			
		||||
import 'package:moneymgr_mobile/services/router/routes_list.dart';
 | 
			
		||||
import 'package:moneymgr_mobile/utils/extensions.dart';
 | 
			
		||||
import 'package:moneymgr_mobile/widgets/app_button.dart';
 | 
			
		||||
 | 
			
		||||
@@ -29,6 +31,11 @@ class ManualAuthScreen extends HookConsumerWidget {
 | 
			
		||||
                tokenValue: tokenValueController.text,
 | 
			
		||||
              ),
 | 
			
		||||
            );
 | 
			
		||||
 | 
			
		||||
        if (context.mounted) {
 | 
			
		||||
          if (context.canPop()) context.pop();
 | 
			
		||||
          context.replace(profilePage);
 | 
			
		||||
        }
 | 
			
		||||
      } catch (e, s) {
 | 
			
		||||
        Logger.root.severe("Failed to authenticate user! $e $s");
 | 
			
		||||
        if (context.mounted) {
 | 
			
		||||
@@ -51,8 +58,7 @@ class ManualAuthScreen extends HookConsumerWidget {
 | 
			
		||||
          keyboardType: TextInputType.url,
 | 
			
		||||
          decoration: const InputDecoration(
 | 
			
		||||
            labelText: 'API URL',
 | 
			
		||||
            helperText:
 | 
			
		||||
                "Format: http://moneymgr.corp.com/api",
 | 
			
		||||
            helperText: "Format: http://moneymgr.corp.com/api",
 | 
			
		||||
          ),
 | 
			
		||||
          textInputAction: TextInputAction.next,
 | 
			
		||||
        ),
 | 
			
		||||
 
 | 
			
		||||
@@ -47,7 +47,7 @@ GoRouter router(Ref ref) {
 | 
			
		||||
      ],
 | 
			
		||||
    ),
 | 
			
		||||
    NavigationItem(
 | 
			
		||||
      path: '/profile',
 | 
			
		||||
      path: profilePage,
 | 
			
		||||
      body: (_) => const Text("Profile"),
 | 
			
		||||
      icon: Icons.person_outline,
 | 
			
		||||
      selectedIcon: Icons.person,
 | 
			
		||||
 
 | 
			
		||||
@@ -9,3 +9,6 @@ const manualAuthPage = "/login/manual";
 | 
			
		||||
 | 
			
		||||
/// Settings path
 | 
			
		||||
const settingsPage = "/settings";
 | 
			
		||||
 | 
			
		||||
// Profile path
 | 
			
		||||
const profilePage = "/profile";
 | 
			
		||||
		Reference in New Issue
	
	Block a user