refactor: update changeUserRole method to accept named parameters for improved clarity and modify ProfilePage to utilize new method signature

This commit is contained in:
2025-12-30 09:40:15 +03:30
parent 71123c3520
commit b7b203ee51
3 changed files with 11 additions and 8 deletions

View File

@@ -173,12 +173,14 @@ class ProfileLogic extends GetxController {
retryNewPasswordController.clear();
}
Future<void> changeUserRole(String newRole) async {
dLog(newRole);
await gService.saveRoute(Module.chicken, newRole);
await gService.saveRole(Module.chicken, newRole);
Future<void> changeUserRole({
required String route,
required String role,
}) async {
await gService.saveRoute(Module.chicken, route);
await gService.saveRole(Module.chicken, role);
Get.offAllNamed(newRole);
Get.offAllNamed(route);
}
void scrollToSelectedItem(

View File

@@ -1003,8 +1003,10 @@ class ProfilePage extends GetView<ProfileLogic> {
title: tmpRole.keys.first,
index: index,
onTap: (int p1) {
controller.changeUserRole(tmpRole.values.first);
controller.changeUserRole(
route: tmpRole.values.first,
role: item?[index] ?? '',
);
},
);
}),

View File

@@ -70,7 +70,6 @@ class RolePage extends GetView<RoleLogic> {
Module.chicken,
route,
);
await controller.gService.saveRole(
Module.chicken,
data[index],