feat: update data profile

This commit is contained in:
akhdanre 2025-06-05 20:44:43 +07:00
parent ae49bb34d0
commit 3cce4faadd
2 changed files with 9 additions and 5 deletions

View File

@ -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 {

View File

@ -70,8 +70,6 @@ class UpdateProfileController extends GetxController {
Future<void> 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");