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 ?? ""; birthDate.value = _userController.userData?.birthDate ?? "";
phoneNumber.value = _userController.userData?.phone ?? ""; phoneNumber.value = _userController.userData?.phone ?? "";
joinDate.value = _userController.userData?.createdAt ?? ""; joinDate.value = _userController.userData?.createdAt ?? "";
} catch (e, stackTrace) { } catch (e, stackTrace) {
logC.e("Failed to load user profile data: $e", stackTrace: stackTrace); logC.e("Failed to load user profile data: $e", stackTrace: stackTrace);
} }
@ -112,8 +113,12 @@ class ProfileController extends GetxController {
} }
} }
void editProfile() { void editProfile() async {
Get.toNamed(AppRoutes.updateProfilePage); final bool resultUpdate = await Get.toNamed(AppRoutes.updateProfilePage);
if (resultUpdate) {
loadUserProfileData();
}
} }
void changeLanguage(BuildContext context, String languageCode, String countryCode) async { void changeLanguage(BuildContext context, String languageCode, String countryCode) async {

View File

@ -70,8 +70,6 @@ class UpdateProfileController extends GetxController {
Future<void> saveProfile() async { Future<void> saveProfile() async {
if (!await _connectionService.isHaveConnection()) { if (!await _connectionService.isHaveConnection()) {
// Get.back();
ConnectionNotification.noInternedConnection(); ConnectionNotification.noInternedConnection();
return; return;
} }
@ -101,6 +99,7 @@ class UpdateProfileController extends GetxController {
locale: userNew.locale, locale: userNew.locale,
picUrl: userNew.picUrl, picUrl: userNew.picUrl,
phone: userNew.phone, phone: userNew.phone,
createdAt: userNew.createdAt,
); );
_userStorageService.saveUser(newUser); _userStorageService.saveUser(newUser);
@ -113,7 +112,7 @@ class UpdateProfileController extends GetxController {
} }
CustomFloatingLoading.hideLoading(); CustomFloatingLoading.hideLoading();
Get.back(); Get.back(result: true);
CustomNotification.success(title: "Success", message: "Profile updated successfully"); CustomNotification.success(title: "Success", message: "Profile updated successfully");
} catch (e) { } catch (e) {
CustomNotification.success(title: "something wrong", message: "failed to update profile"); CustomNotification.success(title: "something wrong", message: "failed to update profile");