Change PasswordIntegration #1
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
import 'package:dio/dio.dart';
|
||||
|
||||
class ChangePasswordService {
|
||||
final Dio _dio;
|
||||
|
||||
ChangePasswordService(this._dio);
|
||||
|
||||
Future getOtp({
|
||||
required String mobileNumber,
|
||||
}) async {
|
||||
final response = await _dio.post(
|
||||
'/api/otp/send',
|
||||
queryParameters: {
|
||||
'mobileNumber': mobileNumber,
|
||||
'type': "CHANGE_LPWORD"
|
||||
},
|
||||
);
|
||||
if (response.statusCode != 200) {
|
||||
throw Exception("Invalid Mobile Number/Type");
|
||||
}
|
||||
return response.toString();
|
||||
}
|
||||
|
||||
|
||||
Future validateOtp({
|
||||
required String otp,
|
||||
required String mobileNumber,
|
||||
}) async {
|
||||
final response = await _dio.post(
|
||||
'/api/otp/verify?mobileNumber=$mobileNumber',
|
||||
queryParameters: {
|
||||
'otp' : otp,
|
||||
},
|
||||
);
|
||||
if (response.statusCode != 200) {
|
||||
throw Exception("Wrong OTP");
|
||||
}
|
||||
return response.toString();
|
||||
}
|
||||
|
||||
Future validateChangePwd({
|
||||
required String OldLPsw,
|
||||
required String newLPsw,
|
||||
required String confirmLPsw,
|
||||
}) async {
|
||||
final response = await _dio.post(
|
||||
'/api/auth/change/login_password',
|
||||
queryParameters: {
|
||||
'OldLPsw': OldLPsw,
|
||||
'newLPsw': newLPsw,
|
||||
'confirmLPsw': confirmLPsw,
|
||||
},
|
||||
);
|
||||
if (response.statusCode != 200) {
|
||||
throw Exception("Wrong OTP");
|
||||
}
|
||||
return response.toString();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user