Refactor code structure for improved readability and maintainability

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
Nils-Johan Gynther
2026-04-23 21:14:46 +02:00
parent cd4274575e
commit db1128ceaf
49 changed files with 285993 additions and 175 deletions
@@ -1,6 +1,7 @@
import 'package:flutter_riverpod/flutter_riverpod.dart';
import '../../../core/api/api_providers.dart';
import '../../../core/platform/platform_providers.dart';
import '../../../core/auth/jwt_decoder.dart';
import 'auth_repository.dart';
final authRepositoryProvider = Provider<AuthRepository>((ref) {
@@ -32,3 +33,9 @@ class AuthNotifier extends AsyncNotifier<String?> {
state = const AsyncData(null);
}
}
/// Synchronously derived provider — true when the current token has role == 'admin'.
final isAdminProvider = Provider<bool>((ref) {
final token = ref.watch(authStateProvider).maybeWhen(data: (t) => t, orElse: () => null);
return jwtIsAdmin(token);
});