forked from eatvio/eatvio_app
40 lines
1023 B
Dart
40 lines
1023 B
Dart
import 'package:eatvio_app/features/auth/models/credentials_model.dart';
|
|
import 'package:eatvio_app/features/auth/models/token_model.dart';
|
|
import 'package:eatvio_app/features/auth/services/auth_service.dart';
|
|
import 'package:eatvio_app/features/auth/models/social_exchange_request.dart';
|
|
|
|
class AuthRepository {
|
|
final AuthService authService;
|
|
|
|
AuthRepository({required this.authService});
|
|
|
|
Future<TokenModel> getTokenByCredentials(
|
|
String email,
|
|
String password,
|
|
) async {
|
|
try {
|
|
return await authService.getTokenByCredentials(
|
|
credentials: CredentialsModel(
|
|
email: email,
|
|
password: password,
|
|
),
|
|
);
|
|
} catch (e) {
|
|
rethrow;
|
|
}
|
|
}
|
|
|
|
Future<TokenModel> getTokenBySocial({
|
|
required String provider,
|
|
required String accessToken,
|
|
}) async {
|
|
try {
|
|
return await authService.getTokenBySocial(
|
|
body: SocialExchangeRequest(provider: provider, accessToken: accessToken),
|
|
);
|
|
} catch (e) {
|
|
rethrow;
|
|
}
|
|
}
|
|
}
|