36 lines
840 B
Dart
36 lines
840 B
Dart
|
|
import 'package:aman_kassa_flutter/core/base/base_service.dart';
|
|
import 'package:aman_kassa_flutter/core/models/user.dart';
|
|
import 'package:flutter/foundation.dart';
|
|
|
|
import 'ApiService.dart';
|
|
|
|
class AuthenticationService extends BaseService {
|
|
|
|
final ApiService _api;
|
|
|
|
AuthenticationService({ApiService api}) : _api = api;
|
|
|
|
User _currentUser;
|
|
User get currentUser => _currentUser;
|
|
|
|
Future loginWithEmail({
|
|
@required String email,
|
|
@required String password,
|
|
}) async {
|
|
try {
|
|
User result = await _api.getUserProfile(123);
|
|
_currentUser = result;
|
|
return result != null;
|
|
} catch (e) {
|
|
return e.message;
|
|
}
|
|
}
|
|
|
|
// Future<bool> isUserLoggedIn() async {
|
|
// var user = await _firebaseAuth.currentUser();
|
|
// await _populateCurrentUser(user);
|
|
// return user != null;
|
|
// }
|
|
}
|