feat : new auth in chicken
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
import 'package:rasadyar_chicken/data/models/response/user_info/user_info_model.dart';
|
||||
import 'package:rasadyar_chicken/data/models/response/user_profile_model/user_profile_model.dart';
|
||||
|
||||
abstract class AuthRepository {
|
||||
Future<UserProfileModel?> login({required Map<String, dynamic> authRequest});
|
||||
|
||||
Future<void> logout();
|
||||
|
||||
Future<bool> hasAuthenticated();
|
||||
|
||||
Future<UserInfoModel?> getUserInfo(String phoneNumber);
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import 'package:rasadyar_chicken/data/data_source/remote/auth/auth_remote.dart';
|
||||
import 'package:rasadyar_chicken/data/models/response/user_info/user_info_model.dart';
|
||||
import 'package:rasadyar_chicken/data/models/response/user_profile_model/user_profile_model.dart';
|
||||
|
||||
import 'auth_repository.dart';
|
||||
|
||||
class AuthRepositoryImpl implements AuthRepository {
|
||||
final AuthRemoteDataSource authRemote;
|
||||
|
||||
AuthRepositoryImpl(this.authRemote);
|
||||
|
||||
@override
|
||||
Future<UserProfileModel?> login({required Map<String, dynamic> authRequest}) async =>
|
||||
await authRemote.login(authRequest: authRequest);
|
||||
|
||||
@override
|
||||
Future<void> logout() async => await authRemote.logout();
|
||||
|
||||
@override
|
||||
Future<bool> hasAuthenticated() async => await authRemote.hasAuthenticated();
|
||||
|
||||
@override
|
||||
Future<UserInfoModel?> getUserInfo(String phoneNumber) async =>
|
||||
await authRemote.getUserInfo(phoneNumber);
|
||||
}
|
||||
Reference in New Issue
Block a user