mirror of
https://github.com/immich-app/immich
synced 2025-11-14 17:36:12 +00:00
refactor(mobile): auth_api.interface.dart (#19350)
This commit is contained in:
parent
af30d97668
commit
69b1331026
4 changed files with 4 additions and 26 deletions
|
|
@ -1,5 +1,4 @@
|
|||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:immich_mobile/interfaces/auth_api.interface.dart';
|
||||
import 'package:immich_mobile/models/auth/login_response.model.dart';
|
||||
import 'package:immich_mobile/providers/api.provider.dart';
|
||||
import 'package:immich_mobile/repositories/api.repository.dart';
|
||||
|
|
@ -9,12 +8,11 @@ import 'package:openapi/api.dart';
|
|||
final authApiRepositoryProvider =
|
||||
Provider((ref) => AuthApiRepository(ref.watch(apiServiceProvider)));
|
||||
|
||||
class AuthApiRepository extends ApiRepository implements IAuthApiRepository {
|
||||
class AuthApiRepository extends ApiRepository {
|
||||
final ApiService _apiService;
|
||||
|
||||
AuthApiRepository(this._apiService);
|
||||
|
||||
@override
|
||||
Future<void> changePassword(String newPassword) async {
|
||||
await _apiService.usersApi.updateMyUser(
|
||||
UserUpdateMeDto(
|
||||
|
|
@ -23,7 +21,6 @@ class AuthApiRepository extends ApiRepository implements IAuthApiRepository {
|
|||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<LoginResponse> login(String email, String password) async {
|
||||
final loginResponseDto = await checkNull(
|
||||
_apiService.authenticationApi.login(
|
||||
|
|
@ -37,7 +34,6 @@ class AuthApiRepository extends ApiRepository implements IAuthApiRepository {
|
|||
return _mapLoginReponse(loginResponseDto);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> logout() async {
|
||||
await _apiService.authenticationApi
|
||||
.logout()
|
||||
|
|
@ -56,7 +52,6 @@ class AuthApiRepository extends ApiRepository implements IAuthApiRepository {
|
|||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<bool> unlockPinCode(String pinCode) async {
|
||||
try {
|
||||
await _apiService.authenticationApi
|
||||
|
|
@ -67,13 +62,11 @@ class AuthApiRepository extends ApiRepository implements IAuthApiRepository {
|
|||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> setupPinCode(String pinCode) {
|
||||
return _apiService.authenticationApi
|
||||
.setupPinCode(PinCodeSetupDto(pinCode: pinCode));
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> lockPinCode() {
|
||||
return _apiService.authenticationApi.lockAuthSession();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue