added guardian login with views for their assigned childs
This commit is contained in:
+10
@@ -2,7 +2,9 @@ import 'dart:developer';
|
||||
|
||||
import 'package:hydrated_bloc/hydrated_bloc.dart';
|
||||
|
||||
import '../../../../../access/access_requirement.dart';
|
||||
import '../../../../../api/errors/error_mapper.dart';
|
||||
import '../../../../../session/session_manager.dart';
|
||||
import '../../loadable_state/loadable_state.dart';
|
||||
import '../../loadable_state/loading_error.dart';
|
||||
import '../../repository/repository.dart';
|
||||
@@ -114,6 +116,13 @@ abstract class LoadableHydratedBloc<
|
||||
add(Reset<TState>());
|
||||
}
|
||||
|
||||
/// Backend identities the data needs. Without them loading is a no-op, so
|
||||
/// reading the bloc in a session that lacks them (e.g. guardians and the
|
||||
/// Nextcloud blocs) is harmless.
|
||||
Set<AccessRequirement> get requirements => const {};
|
||||
|
||||
bool get requirementsMet => requirements.areMetBy(SessionManager().current);
|
||||
|
||||
TState? get innerState => state.data;
|
||||
TRepository get repo => _repository;
|
||||
|
||||
@@ -137,6 +146,7 @@ abstract class LoadableHydratedBloc<
|
||||
);
|
||||
|
||||
void fetch() {
|
||||
if (!requirementsMet) return;
|
||||
log('Fetching data for ${TState.toString()}');
|
||||
gatherData()
|
||||
.catchError((Object e) {
|
||||
|
||||
Reference in New Issue
Block a user