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';
|
import 'package:model/model.dart';
|
||||||
|
|
||||||
abstract class AuthenticationRepository {
|
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 removePassword();
|
||||||
|
|
||||||
Future<Password> getPassword();
|
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';
|
import 'package:model/model.dart';
|
||||||
|
|
||||||
class AuthenticationUserViewState extends UIState {
|
class AuthenticationUserViewState extends UIState {
|
||||||
final User user;
|
final UserProfile userProfile;
|
||||||
|
|
||||||
AuthenticationUserViewState(this.user);
|
AuthenticationUserViewState(this.userProfile);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
List<Object> get props => [user];
|
List<Object> get props => [userProfile];
|
||||||
}
|
}
|
||||||
|
|
||||||
class AuthenticationUserFailure extends FeatureFailure {
|
class AuthenticationUserFailure extends FeatureFailure {
|
||||||
|
|||||||
@@ -17,7 +17,8 @@ class AuthenticationInteractor {
|
|||||||
await Future.wait([
|
await Future.wait([
|
||||||
credentialRepository.saveBaseUrl(baseUrl),
|
credentialRepository.saveBaseUrl(baseUrl),
|
||||||
credentialRepository.saveUserName(userName),
|
credentialRepository.saveUserName(userName),
|
||||||
credentialRepository.savePassword(password)
|
credentialRepository.savePassword(password),
|
||||||
|
credentialRepository.saveUserProfile(user),
|
||||||
]);
|
]);
|
||||||
return Right(AuthenticationUserViewState(user));
|
return Right(AuthenticationUserViewState(user));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
@@ -15,7 +15,8 @@ class DeleteCredentialInteractor {
|
|||||||
await Future.wait([
|
await Future.wait([
|
||||||
credentialRepository.removeBaseUrl(),
|
credentialRepository.removeBaseUrl(),
|
||||||
credentialRepository.removeUserName(),
|
credentialRepository.removeUserName(),
|
||||||
credentialRepository.removePassword()
|
credentialRepository.removePassword(),
|
||||||
|
credentialRepository.removeUserProfile(),
|
||||||
]);
|
]);
|
||||||
return Right(DeleteCredentialSuccess());
|
return Right(DeleteCredentialSuccess());
|
||||||
} catch (exception) {
|
} catch (exception) {
|
||||||
|
|||||||
Reference in New Issue
Block a user