strip auth
This commit is contained in:
@@ -1,44 +0,0 @@
|
||||
import 'package:pocketbase/pocketbase.dart';
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
import 'package:weblibre/features/user/domain/entities/auth_exception.dart';
|
||||
import 'package:weblibre/features/user/domain/providers.dart';
|
||||
import 'package:weblibre/features/user/extensions/client_exception.dart';
|
||||
|
||||
part 'auth.g.dart';
|
||||
|
||||
@Riverpod()
|
||||
class AuthRepository extends _$AuthRepository {
|
||||
late PocketBase _pb;
|
||||
|
||||
Future<RecordAuth> authWithPassword(String user, String password) async {
|
||||
try {
|
||||
return await _pb.collection('users').authWithPassword(user, password);
|
||||
} on ClientException catch (e) {
|
||||
throw AuthException(e.errorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
Future<RecordModel> createUserWithPassword(
|
||||
String email,
|
||||
String password,
|
||||
) async {
|
||||
try {
|
||||
return await _pb
|
||||
.collection('users')
|
||||
.create(
|
||||
body: {
|
||||
"email": email,
|
||||
"password": password,
|
||||
"passwordConfirm": password,
|
||||
},
|
||||
);
|
||||
} on ClientException catch (e) {
|
||||
throw AuthException(e.errorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void build() {
|
||||
_pb = ref.watch(pocketBaseProvider);
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'auth.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// RiverpodGenerator
|
||||
// **************************************************************************
|
||||
|
||||
String _$authRepositoryHash() => r'90ea6f082ef968831763c7f7ee31863f1fe329fe';
|
||||
|
||||
/// See also [AuthRepository].
|
||||
@ProviderFor(AuthRepository)
|
||||
final authRepositoryProvider =
|
||||
AutoDisposeNotifierProvider<AuthRepository, void>.internal(
|
||||
AuthRepository.new,
|
||||
name: r'authRepositoryProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$authRepositoryHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
typedef _$AuthRepository = AutoDisposeNotifier<void>;
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
||||
Reference in New Issue
Block a user