authRepositoryProvider top-level property

Provider<AuthRepository> authRepositoryProvider
final

Provides the AuthRepository instance.

Implementation

final authRepositoryProvider = Provider<AuthRepository>((ref) {
  return AuthRepository(
    portalService: ref.watch(portalServiceProvider),
    studentQueryService: ref.watch(studentQueryServiceProvider),
    database: ref.watch(databaseProvider),
    secureStorage: _secureStorage,
    isDemo: ref.watch(isDemoProvider),
    onSessionCreated: () {
      ref.read(sessionProvider.notifier).create();
    },
    onSessionDestroyed: ([exception]) {
      ref.read(sessionProvider.notifier).destroy(exception);
    },
    onCredentialsUpdated:
        ({
          required username,
          required password,
          previousUsername,
          previousPassword,
        }) async {
          await ref
              .read(ntut8021xAutoReprovisionProvider)
              .reprovisionIfEnabled(
                identity: username,
                password: password,
                previousIdentity: previousUsername,
                previousPassword: previousPassword,
              );
        },
  );
});