TF-34 Add domain layer login for fix bug mock data user
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import 'package:model/model.dart';
|
||||
|
||||
abstract class AuthenticationRepository {
|
||||
Future<User> authenticationUser(Uri baseUrl, UserName userName, Password password);
|
||||
Future<UserProfile> authenticationUser(Uri baseUrl, UserName userName, Password password);
|
||||
}
|
||||
@@ -18,4 +18,10 @@ abstract class CredentialRepository {
|
||||
Future removePassword();
|
||||
|
||||
Future<Password> getPassword();
|
||||
|
||||
Future saveUserProfile(UserProfile userProfile);
|
||||
|
||||
Future removeUserProfile();
|
||||
|
||||
Future<UserProfile> getUserProfile();
|
||||
}
|
||||
@@ -2,12 +2,12 @@ import 'package:core/core.dart';
|
||||
import 'package:model/model.dart';
|
||||
|
||||
class AuthenticationUserViewState extends UIState {
|
||||
final User user;
|
||||
final UserProfile userProfile;
|
||||
|
||||
AuthenticationUserViewState(this.user);
|
||||
AuthenticationUserViewState(this.userProfile);
|
||||
|
||||
@override
|
||||
List<Object> get props => [user];
|
||||
List<Object> get props => [userProfile];
|
||||
}
|
||||
|
||||
class AuthenticationUserFailure extends FeatureFailure {
|
||||
|
||||
@@ -17,7 +17,8 @@ class AuthenticationInteractor {
|
||||
await Future.wait([
|
||||
credentialRepository.saveBaseUrl(baseUrl),
|
||||
credentialRepository.saveUserName(userName),
|
||||
credentialRepository.savePassword(password)
|
||||
credentialRepository.savePassword(password),
|
||||
credentialRepository.saveUserProfile(user),
|
||||
]);
|
||||
return Right(AuthenticationUserViewState(user));
|
||||
} catch (e) {
|
||||
|
||||
@@ -15,7 +15,8 @@ class DeleteCredentialInteractor {
|
||||
await Future.wait([
|
||||
credentialRepository.removeBaseUrl(),
|
||||
credentialRepository.removeUserName(),
|
||||
credentialRepository.removePassword()
|
||||
credentialRepository.removePassword(),
|
||||
credentialRepository.removeUserProfile(),
|
||||
]);
|
||||
return Right(DeleteCredentialSuccess());
|
||||
} catch (exception) {
|
||||
|
||||
Reference in New Issue
Block a user