51 lines
1.5 KiB
Dart
51 lines
1.5 KiB
Dart
import 'package:tm_app/data/services/model/forgot_password_response/forgot_password_response_model.dart';
|
|
import 'package:tm_app/data/services/model/login_response/login_response_model.dart';
|
|
import 'package:tm_app/data/services/model/verify_otp_response/verify_otp_response_model.dart';
|
|
|
|
import '../../core/utils/result.dart';
|
|
import '../services/auth_service.dart';
|
|
import '../services/model/logout_response/logout_response.dart';
|
|
import '../services/model/reset_password_response/reset_password_response.dart';
|
|
|
|
class AuthRepository {
|
|
final AuthService _authService;
|
|
|
|
AuthRepository({required AuthService authService})
|
|
: _authService = authService;
|
|
|
|
Future<Result<LoginResponseModel>> login({
|
|
required String username,
|
|
required String password,
|
|
}) async {
|
|
return _authService.login(username: username, password: password);
|
|
}
|
|
|
|
Future<Result<LogoutResponse>> logout() async {
|
|
return _authService.logout();
|
|
}
|
|
|
|
Future<Result<ResetPasswordResponse>> resetPassword({
|
|
required String newPassword,
|
|
required String token,
|
|
}) async {
|
|
return _authService.resetPassword(newPassword: newPassword, token: token);
|
|
}
|
|
|
|
Future<void> localLogout() async {
|
|
return _authService.localLogout();
|
|
}
|
|
|
|
Future<Result<ForgotPasswordResponseModel>> forgotPassword({
|
|
required String email,
|
|
}) async {
|
|
return _authService.forgotPassword(email: email);
|
|
}
|
|
|
|
Future<Result<VerifyOtpResponseModel>> verifyOtp({
|
|
required String code,
|
|
required String email,
|
|
}) async {
|
|
return _authService.verifyOtp(code: code, email: email);
|
|
}
|
|
}
|