mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-15 17:47:28 +00:00
remove role model
This commit is contained in:
@ -307,10 +307,10 @@ class HomeCubit extends Cubit<HomeState> {
|
||||
} 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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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<String, dynamic> json) {
|
||||
return Role(
|
||||
uuid: json['uuid'],
|
||||
createdAt: DateTime.parse(json['createdAt']),
|
||||
updatedAt: DateTime.parse(json['updatedAt']),
|
||||
type: json['type'],
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> 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<String, dynamic> 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(),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -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');
|
||||
|
Reference in New Issue
Block a user