From 3cce4faadd16c5394ceced7d0ae212899783f8c7 Mon Sep 17 00:00:00 2001 From: akhdanre Date: Thu, 5 Jun 2025 20:44:43 +0700 Subject: [PATCH] feat: update data profile --- lib/feature/profile/controller/profile_controller.dart | 9 +++++++-- .../profile/controller/update_profile_controller.dart | 5 ++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/feature/profile/controller/profile_controller.dart b/lib/feature/profile/controller/profile_controller.dart index 44da7fe..cf08049 100644 --- a/lib/feature/profile/controller/profile_controller.dart +++ b/lib/feature/profile/controller/profile_controller.dart @@ -71,6 +71,7 @@ class ProfileController extends GetxController { birthDate.value = _userController.userData?.birthDate ?? ""; phoneNumber.value = _userController.userData?.phone ?? ""; joinDate.value = _userController.userData?.createdAt ?? ""; + } catch (e, stackTrace) { logC.e("Failed to load user profile data: $e", stackTrace: stackTrace); } @@ -112,8 +113,12 @@ class ProfileController extends GetxController { } } - void editProfile() { - Get.toNamed(AppRoutes.updateProfilePage); + void editProfile() async { + final bool resultUpdate = await Get.toNamed(AppRoutes.updateProfilePage); + + if (resultUpdate) { + loadUserProfileData(); + } } void changeLanguage(BuildContext context, String languageCode, String countryCode) async { diff --git a/lib/feature/profile/controller/update_profile_controller.dart b/lib/feature/profile/controller/update_profile_controller.dart index bfbf60f..57d4e9b 100644 --- a/lib/feature/profile/controller/update_profile_controller.dart +++ b/lib/feature/profile/controller/update_profile_controller.dart @@ -70,8 +70,6 @@ class UpdateProfileController extends GetxController { Future saveProfile() async { if (!await _connectionService.isHaveConnection()) { - // Get.back(); - ConnectionNotification.noInternedConnection(); return; } @@ -101,6 +99,7 @@ class UpdateProfileController extends GetxController { locale: userNew.locale, picUrl: userNew.picUrl, phone: userNew.phone, + createdAt: userNew.createdAt, ); _userStorageService.saveUser(newUser); @@ -113,7 +112,7 @@ class UpdateProfileController extends GetxController { } CustomFloatingLoading.hideLoading(); - Get.back(); + Get.back(result: true); CustomNotification.success(title: "Success", message: "Profile updated successfully"); } catch (e) { CustomNotification.success(title: "something wrong", message: "failed to update profile");