Skip to content

Commit

Permalink
Merge branch 'release/2.3.1' of https://github.com/JoinSEEDS/seeds_li…
Browse files Browse the repository at this point in the history
…ght_wallet into release/2.3.1
  • Loading branch information
n13 committed Oct 27, 2021
2 parents 49aa626 + b9e83de commit be834a7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@ import 'package:seeds/screens/authentication/sign_up/viewmodels/bloc.dart';
import 'package:seeds/screens/authentication/sign_up/viewmodels/states/create_username_state.dart';

class CreateUsernameMapper extends StateMapper {
SignupState mapValidateUsernameToState(SignupState currentState, Result result) {
SignupState mapValidateUsernameToState(SignupState currentState, String username, Result result) {
final createUsernameCurrentState = currentState.createUsernameState;

if (result.isError) {
// Error means username is not taken and is available for the user to take it
final newState = createUsernameCurrentState.copyWith(pageState: PageState.success);
final newState = createUsernameCurrentState.copyWith(
username: username,
pageState: PageState.success,
);

return currentState.copyWith(createUsernameState: newState);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class CreateUsernameUseCase {

final Result result = await _signupRepository.isUsernameTaken(username);

yield CreateUsernameMapper().mapValidateUsernameToState(currentState, result);
yield CreateUsernameMapper().mapValidateUsernameToState(currentState, username, result);
} else {
yield currentState.copyWith(
createUsernameState: CreateUsernameState.error(currentState.createUsernameState, validationError));
Expand Down

0 comments on commit be834a7

Please sign in to comment.