Skip to content

Commit

Permalink
feat: add IonApiClient to SignUp
Browse files Browse the repository at this point in the history
  • Loading branch information
ice-tychon committed Aug 13, 2024
1 parent 96ae70f commit a56a9e4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
13 changes: 12 additions & 1 deletion lib/app/features/auth/providers/auth_provider.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:ice/app/features/auth/data/models/auth_state.dart';
import 'package:ice/app/features/auth/data/models/auth_token.dart';
import 'package:ice/app/features/core/providers/env_provider.dart';
import 'package:ion_identity_client/ion_client.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';

part 'auth_provider.g.dart';
Expand All @@ -24,7 +25,17 @@ class Auth extends _$Auth {
Future<void> signIn({required String keyName}) async {
try {
state = const AuthenticationLoading();
await Future<void>.delayed(const Duration(seconds: 2));

final config = IonClientConfig(
appId: 'ap-dhesg-ct1r8-lu8a7rrodm4an8u',
orgId: 'or-625fn-dfjva-8b993vdrf414bkd8',
origin: 'https://dfns.blockchain.ice.vip',
);

final ionClient = IonApiClient.createDefault(config: config);

final result = await ionClient.auth.registerUser(username: keyName);

state = const Authenticated(
authToken: AuthToken(access: 'access', refresh: 'refresh'),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class IdentityKeyNameInput extends HookWidget {
Widget build(BuildContext context) {
final hideKeyboardAndCallOnce = useHideKeyboardAndCallOnce();
return TextInput(
keyboardType: TextInputType.emailAddress,
prefixIcon: TextInputIcons(
hasRightDivider: true,
icons: [Assets.images.icons.iconIdentitykey.icon()],
Expand Down

0 comments on commit a56a9e4

Please sign in to comment.