mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 07:07:19 +00:00
Merge branch 'dev' of https://github.com/SyncrowIOT/web into feature/space-management
This commit is contained in:
@ -16,11 +16,11 @@ class HomeBloc extends Bloc<HomeEvent, HomeState> {
|
||||
final BuchheimWalkerConfiguration builder = BuchheimWalkerConfiguration();
|
||||
List<Node> sourcesList = [];
|
||||
List<Node> destinationsList = [];
|
||||
static UserModel? user;
|
||||
UserModel? user;
|
||||
|
||||
HomeBloc() : super((HomeInitial())) {
|
||||
on<CreateNewNode>(_createNode);
|
||||
fetchUserInfo();
|
||||
on<FetchUserInfo>(_fetchUserInfo);
|
||||
}
|
||||
|
||||
void _createNode(CreateNewNode event, Emitter<HomeState> emit) async {
|
||||
@ -39,17 +39,27 @@ class HomeBloc extends Bloc<HomeEvent, HomeState> {
|
||||
emit(HomeUpdateTree(graph: graph, builder: builder));
|
||||
}
|
||||
|
||||
Future fetchUserInfo() async {
|
||||
Future _fetchUserInfo(FetchUserInfo event, Emitter<HomeState> emit) async {
|
||||
try {
|
||||
var uuid =
|
||||
await const FlutterSecureStorage().read(key: UserModel.userUuidKey);
|
||||
user = await HomeApi().fetchUserInfo(uuid);
|
||||
emit(HomeUserInfoLoaded(user!)); // Emit state after fetching user info
|
||||
emit(HomeInitial());
|
||||
} catch (e) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// static Future fetchUserInfo() async {
|
||||
// try {
|
||||
// var uuid =
|
||||
// await const FlutterSecureStorage().read(key: UserModel.userUuidKey);
|
||||
// user = await HomeApi().fetchUserInfo(uuid);
|
||||
// } catch (e) {
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
|
||||
List<HomeItemModel> homeItems = [
|
||||
HomeItemModel(
|
||||
title: 'Access',
|
||||
|
Reference in New Issue
Block a user