Skip to content

Commit

Permalink
fix: email/phonenumber username not persisted to next component (#1588)
Browse files Browse the repository at this point in the history
  • Loading branch information
haverchuck authored May 13, 2022
1 parent 966d9ed commit f6d8b8c
Showing 1 changed file with 1 addition and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,7 @@ mixin AuthenticatorUsernameField<FieldType,
on AuthenticatorFormFieldState<FieldType, UsernameInput, T> {
@override
UsernameInput? get initialValue {
String? username;
switch (selectedUsernameType) {
case UsernameType.username:
username = state.username;
break;
case UsernameType.email:
username = state.getAttribute(CognitoUserAttributeKey.email);
break;
case UsernameType.phoneNumber:
username = state.getAttribute(CognitoUserAttributeKey.phoneNumber);
break;
}

return UsernameInput(type: selectedUsernameType, username: username ?? '');
return UsernameInput(type: selectedUsernameType, username: state.username);
}

@override
Expand Down

0 comments on commit f6d8b8c

Please sign in to comment.