Skip to content

Commit

Permalink
enable data observer only for auth users
Browse files Browse the repository at this point in the history
  • Loading branch information
yurydemin committed Jun 9, 2021
1 parent c6e0de2 commit 758eeee
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/content/content_navigator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ class ContentNavigator extends StatelessWidget {
contentCubit: context.read<ContentCubit>(),
sheltersRepo: context.read<SheltersRepository>(),
petsRepo: context.read<PetsRepository>())
..getShelters(),
//..observeShelters(),
..getShelters()
..observeShelters(),
child: BlocProvider(
create: (context) => FilteredSheltersBloc(
sheltersCubit: context.read<SheltersCubit>(),
Expand Down
1 change: 1 addition & 0 deletions lib/content/shelters/shelters_cubit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class SheltersCubit extends Cubit<SheltersState> {
}

void observeShelters() {
if (!contentCubit.isUserLoggedIn) return;
final sheltersStream = sheltersRepo.observeShelters();
sheltersStream.listen((_) => getShelters());
}
Expand Down

0 comments on commit 758eeee

Please sign in to comment.