feat(authentication)!: add repo in callback usecases (close #55)
This commit was merged in pull request #61.
This commit is contained in:
@@ -23,6 +23,7 @@ import 'package:wyatt_type_utils/wyatt_type_utils.dart';
|
||||
import 'package:wyatt_architecture/wyatt_architecture.dart';
|
||||
|
||||
FutureOrResult<int?> onSignUpSuccess(
|
||||
AuthenticationRepository<int> repo,
|
||||
Account? account,
|
||||
WyattForm form,
|
||||
) async {
|
||||
@@ -35,9 +36,15 @@ FutureOrResult<int?> onSignUpSuccess(
|
||||
return const Ok<int, AppException>(id);
|
||||
}
|
||||
|
||||
FutureOrResult<int?> onAccountChanges(Account? account) async {
|
||||
FutureOrResult<int?> onAccountChanges(
|
||||
AuthenticationRepository<int> repo,
|
||||
Account? account,
|
||||
) async {
|
||||
final id = Random().nextInt(1000);
|
||||
debugPrint('onAccountChanges: $account, generatedId: $id');
|
||||
final token =
|
||||
await repo.getIdentityToken().fold((value) => value, (error) => 'null');
|
||||
|
||||
debugPrint('onAccountChanges: $account, token: $token, generatedId: $id');
|
||||
return Ok<int, AppException>(id);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user