diff --git a/lib/features/app_layout/bloc/home_cubit.dart b/lib/features/app_layout/bloc/home_cubit.dart index abd7066..dc951ab 100644 --- a/lib/features/app_layout/bloc/home_cubit.dart +++ b/lib/features/app_layout/bloc/home_cubit.dart @@ -307,10 +307,10 @@ class HomeCubit extends Cubit { } on DioException catch (e) { final errorMessage = e.response?.data['error']['message']; emitSafe(ActivationError(errMessage: errorMessage)); - return errorMessage; + return false; } catch (e) { emitSafe(ActivationError(errMessage: e.toString())); - return e.toString(); + return false; } } diff --git a/lib/features/auth/model/user_model.dart b/lib/features/auth/model/user_model.dart index 6384778..5e055a7 100644 --- a/lib/features/auth/model/user_model.dart +++ b/lib/features/auth/model/user_model.dart @@ -2,38 +2,6 @@ import 'dart:convert'; import 'package:flutter/foundation.dart'; import 'package:syncrow_app/features/auth/model/token.dart'; -class Role { - final String uuid; - final DateTime createdAt; - final DateTime updatedAt; - final String type; - - Role({ - required this.uuid, - required this.createdAt, - required this.updatedAt, - required this.type, - }); - - factory Role.fromJson(Map json) { - return Role( - uuid: json['uuid'], - createdAt: DateTime.parse(json['createdAt']), - updatedAt: DateTime.parse(json['updatedAt']), - type: json['type'], - ); - } - - Map toJson() { - return { - 'uuid': uuid, - 'createdAt': createdAt.toIso8601String(), - 'updatedAt': updatedAt.toIso8601String(), - 'type': type, - }; - } -} - class UserModel { static String userUuidKey = 'userUuid'; final String? uuid; @@ -47,7 +15,6 @@ class UserModel { final String? timeZone; final String? regionUuid; final bool? isAgreementAccepted; - final Role? role; UserModel({ required this.uuid, @@ -61,7 +28,7 @@ class UserModel { required this.isAgreementAccepted, required this.regionName, required this.timeZone, - required this.role, + // required this.role, }); factory UserModel.fromJson(Map json) { @@ -77,7 +44,6 @@ class UserModel { regionName: json['region']?['regionName'], timeZone: json['timeZone']?['timeZoneOffset'], regionUuid: json['region']?['uuid'], - role: json['role'] != null ? Role.fromJson(json['role']) : null, ); } @@ -95,7 +61,6 @@ class UserModel { regionUuid: null, regionName: tempJson['region']?['regionName'], timeZone: tempJson['timezone']?['timeZoneOffset'], - role: tempJson['role'] != null ? Role.fromJson(tempJson['role']) : null, ); } @@ -112,14 +77,14 @@ class UserModel { 'email': email, 'firstName': firstName, 'lastName': lastName, - 'profilePicture': profilePicture != null ? base64.encode(profilePicture!) : null, + 'profilePicture': + profilePicture != null ? base64.encode(profilePicture!) : null, 'phoneNumber': phoneNumber, 'isEmailVerified': isEmailVerified, 'regionUuid': regionUuid, 'isAgreementAccepted': isAgreementAccepted, 'regionName': regionName, 'timeZone': timeZone, - 'role': role?.toJson(), }; } } diff --git a/lib/features/menu/view/widgets/join_home/join_home_view.dart b/lib/features/menu/view/widgets/join_home/join_home_view.dart index 0272cc4..4f3a60e 100644 --- a/lib/features/menu/view/widgets/join_home/join_home_view.dart +++ b/lib/features/menu/view/widgets/join_home/join_home_view.dart @@ -57,8 +57,7 @@ class JoinHomeView extends StatelessWidget { 'Please enter the invitation code'); return; } - if (await HomeCubit.getInstance() - .activationCode(textEditingController.text)) { + if (await HomeCubit.getInstance().activationCode(textEditingController.text)) { await HomeCubit.getInstance().fetchUnitsByUserId(); CustomSnackBar.displaySnackBar('Done successfully');