Add presentation layer for get Session
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import 'package:core/core.dart';
|
||||
import 'package:model/model.dart';
|
||||
|
||||
class AuthenticationUserViewState extends ViewState {
|
||||
class AuthenticationUserViewState extends UIState {
|
||||
final User user;
|
||||
|
||||
AuthenticationUserViewState(this.user);
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
import 'package:core/core.dart';
|
||||
import 'package:core/presentation/state/failure.dart';
|
||||
|
||||
class DeleteCredentialSuccess extends UIState {
|
||||
DeleteCredentialSuccess();
|
||||
|
||||
@override
|
||||
List<Object> get props => [];
|
||||
}
|
||||
|
||||
class DeleteCredentialFailure extends FeatureFailure {
|
||||
final exception;
|
||||
|
||||
DeleteCredentialFailure(this.exception);
|
||||
|
||||
@override
|
||||
List<Object> get props => [exception];
|
||||
}
|
||||
@@ -3,7 +3,7 @@ import 'package:core/presentation/state/failure.dart';
|
||||
import 'package:model/account/password.dart';
|
||||
import 'package:model/account/user_name.dart';
|
||||
|
||||
class GetCredentialViewState extends ViewState {
|
||||
class GetCredentialViewState extends UIState {
|
||||
final Uri baseUrl;
|
||||
final UserName userName;
|
||||
final Password password;
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
import 'dart:core';
|
||||
|
||||
import 'package:core/core.dart';
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:tmail_ui_user/features/login/domain/repository/credential_repository.dart';
|
||||
import 'package:tmail_ui_user/features/login/domain/state/delete_credential_state.dart';
|
||||
|
||||
class DeleteCredentialInteractor {
|
||||
final CredentialRepository credentialRepository;
|
||||
|
||||
DeleteCredentialInteractor(this.credentialRepository);
|
||||
|
||||
Future<Either<Failure, Success>> execute() async {
|
||||
try {
|
||||
await Future.wait([
|
||||
credentialRepository.removeBaseUrl(),
|
||||
credentialRepository.removeUserName(),
|
||||
credentialRepository.removePassword()
|
||||
]);
|
||||
return Right(DeleteCredentialSuccess());
|
||||
} catch (exception) {
|
||||
return Left(DeleteCredentialFailure(exception));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -60,7 +60,7 @@ class LoginController extends GetxController {
|
||||
loginState.value = LoginState(Right(success));
|
||||
_dynamicUrlInterceptors.changeBaseUrl(_urlText);
|
||||
_authorizationInterceptors.changeAuthorization(_userNameText, _passwordText);
|
||||
Get.offNamed(AppRoutes.MAILBOX_DASHBOARD);
|
||||
Get.offNamed(AppRoutes.SESSION);
|
||||
}
|
||||
|
||||
void _loginFailureAction(AuthenticationUserFailure failure) {
|
||||
|
||||
Reference in New Issue
Block a user