diff --git a/app_petty_cash/lib/repository/auth_repository.dart b/app_petty_cash/lib/repository/auth_repository.dart index bb1540a..99ecb32 100644 --- a/app_petty_cash/lib/repository/auth_repository.dart +++ b/app_petty_cash/lib/repository/auth_repository.dart @@ -62,11 +62,13 @@ class AuthRepository extends BaseRepository { Future changePassword({ required String userID, required String token, + required String tokenx, required String oldPassword, required String newPassword, required String confirmPassword, }) async { final param = { + "tokenx": tokenx, "token": token, "M_UserID": userID, "old_password": oldPassword, diff --git a/app_petty_cash/lib/screen/change_pasword/change_password_provider.dart b/app_petty_cash/lib/screen/change_pasword/change_password_provider.dart index 20f3a8c..fd55a23 100644 --- a/app_petty_cash/lib/screen/change_pasword/change_password_provider.dart +++ b/app_petty_cash/lib/screen/change_pasword/change_password_provider.dart @@ -40,7 +40,6 @@ class ChangePasswordStateDone extends ChangePasswordState { }) : super(DateTime.now()); } - //notifier class ChangePasswordNotifier extends StateNotifier { final Ref ref; @@ -51,16 +50,21 @@ class ChangePasswordNotifier extends StateNotifier { void postChangePassword({ required String userID, required String userToken, + required String userTokenx, required String oldPassword, required String newPassword, required String confirmPassword, - - }) async { + }) async { try { state = ChangePasswordStateLoading(); final dio = ref.read(dioProvider); - final resp = - await AuthRepository(dio: dio).changePassword(userID: userID,token: userToken, oldPassword: oldPassword, newPassword: newPassword, confirmPassword: confirmPassword); + final resp = await AuthRepository(dio: dio).changePassword( + userID: userID, + tokenx: userTokenx, + token: userToken, + oldPassword: oldPassword, + newPassword: newPassword, + confirmPassword: confirmPassword); state = ChangePasswordStateDone(model: resp); } catch (e) { if (e is BaseRepositoryException) { @@ -76,4 +80,4 @@ class ChangePasswordNotifier extends StateNotifier { final ChangePasswordProvider = StateNotifierProvider( (ref) => ChangePasswordNotifier(ref: ref), -); \ No newline at end of file +); diff --git a/app_petty_cash/lib/screen/change_pasword/change_password_screen.dart b/app_petty_cash/lib/screen/change_pasword/change_password_screen.dart index de36712..93ee98a 100644 --- a/app_petty_cash/lib/screen/change_pasword/change_password_screen.dart +++ b/app_petty_cash/lib/screen/change_pasword/change_password_screen.dart @@ -23,6 +23,7 @@ class ChangePasswordScreen extends HookConsumerWidget { //menampung user token jika ada final userToken = ref.read(currentUserProvider)?.token ?? ""; final userID = ref.read(currentUserProvider)?.model.M_UserID ?? "0"; + final tokenx = ref.read(currentUserProvider)?.token ?? ""; final isLoading = useState(false); final obscureText = useState(true); @@ -357,6 +358,7 @@ class ChangePasswordScreen extends HookConsumerWidget { ref .read(ChangePasswordProvider.notifier) .postChangePassword( + userTokenx: tokenx, userToken: userToken, userID: userID, oldPassword: ctrlOldPassword.text, diff --git a/app_petty_cash/pubspec.lock b/app_petty_cash/pubspec.lock index 1af8165..e30ed56 100644 --- a/app_petty_cash/pubspec.lock +++ b/app_petty_cash/pubspec.lock @@ -901,6 +901,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.0.17" + web: + dependency: transitive + description: + name: web + sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152 + url: "https://pub.dev" + source: hosted + version: "0.3.0" whatsapp_share: dependency: "direct main" description: