forked from eatvio/eatvio_app
feat(setting): added profile data apdating for sttings screen, added validation for general info form
This commit is contained in:
@@ -7,7 +7,19 @@ import 'package:eatvio_app/core/error_reporting/report_from.dart';
|
||||
|
||||
class MenuCubit extends Cubit<MenuState> {
|
||||
final ProfileRepository profileRepository;
|
||||
MenuCubit(this.profileRepository) : super(MenuState());
|
||||
MenuCubit(this.profileRepository) : super(const MenuState.initial());
|
||||
|
||||
Future<void> getMyProfile() async {
|
||||
emit(const MenuState.loading());
|
||||
try {
|
||||
final profile = await profileRepository.getMyProfile();
|
||||
emit(MenuState.loaded(profileModel: profile));
|
||||
} catch (e, st) {
|
||||
await reportFrom(e, st, this);
|
||||
log(e.toString());
|
||||
emit(const MenuState.error());
|
||||
}
|
||||
}
|
||||
|
||||
Future<String?> makePassKey() async {
|
||||
try {
|
||||
|
||||
@@ -1 +1,17 @@
|
||||
class MenuState {}
|
||||
import 'package:eatvio_app/features/profile/models/profile_model.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'menu_state.freezed.dart';
|
||||
|
||||
@freezed
|
||||
abstract class MenuState with _$MenuState {
|
||||
const factory MenuState.initial() = MenuStateInitial;
|
||||
|
||||
const factory MenuState.loading() = MenuStateLoading;
|
||||
|
||||
const factory MenuState.loaded({
|
||||
required ProfileModel profileModel,
|
||||
}) = MenuStateLoaded;
|
||||
|
||||
const factory MenuState.error() = MenuStateError;
|
||||
}
|
||||
Reference in New Issue
Block a user