You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
1.0 KiB
Dart
36 lines
1.0 KiB
Dart
import 'package:driverapp/config/config.dart';
|
|
import 'package:driverapp/core/model/authentication/authenticated_user.dart';
|
|
import 'package:driverapp/core/model/authentication/login_request.dart';
|
|
import 'package:driverapp/core/service/base_service.dart';
|
|
|
|
class AuthenticationService extends BaseService {
|
|
String selectedClinicName;
|
|
bool isLogin = false;
|
|
bool isLoading = true;
|
|
AuthenticatedUser authenticatedUser;
|
|
String token;
|
|
|
|
AuthenticationService() {
|
|
// getUserAuthentication();
|
|
}
|
|
|
|
login(LoginRequest loginRequest) async {
|
|
hasError = false;
|
|
try {
|
|
await baseAppClient.post(LOGIN,
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
authenticatedUser =
|
|
AuthenticatedUser.fromJson(response['PatientER_DriverFile']);
|
|
token = response['LogInTokenID'];
|
|
}, onFailure: (String error, int statusCode) {
|
|
hasError = true;
|
|
super.error = error;
|
|
}, body: loginRequest.toJson());
|
|
} catch (error) {
|
|
hasError = true;
|
|
super.error = error;
|
|
throw error;
|
|
}
|
|
}
|
|
}
|