Skip to content

Commit

Permalink
fix(sign_up): created paintz not linked after signing up
Browse files Browse the repository at this point in the history
  • Loading branch information
mthongvanh committed Jul 18, 2024
1 parent f13d5d3 commit a267384
Showing 1 changed file with 4 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,11 @@ class FirebaseAuthRemoteDataSource extends AuthRemoteDataSource {
required final String password,
final String? displayName,
}) async {
late final UserCredential response;
response = await _firebaseAuth.createUserWithEmailAndPassword(
email: identifier,
password: password,
);

final user = _firebaseAuth.currentUser;
// link the anonymous user with a newly-created firebase user
if (response.credential != null) {
await user?.linkWithCredential(response.credential!);
}
final emailCredential =
EmailAuthProvider.credential(email: identifier, password: password);
final response = await user?.linkWithCredential(emailCredential);

// only update the display name if one was supplied or it's different from
// the current display name
Expand All @@ -89,7 +83,7 @@ class FirebaseAuthRemoteDataSource extends AuthRemoteDataSource {
await updateUserDisplayName(displayName);
}

return response.toModel();
return response!.toModel();
}

/// Sign out a user
Expand Down

0 comments on commit a267384

Please sign in to comment.