loginKpUser static method
Implementation
static Future<Result<LoginResponseData?>> loginKpUser() async {
final result = await checkKwikpassHealth();
if(result.isSuccess) {
final healthData = result.getDataOrThrow();
if(healthData?.isKwikpassHealthy == false){
throw Exception('Kwikpass is unhealthy');
}
}
try {
final gokwik = DioClient().getClient();
// final response =
// (await gokwik.get('customer/custom/login')).toBaseResponse(
// fromJson: (json) => LoginResponseData.fromJson(json),
// );
final response =
(await gokwik.get(cdnConfigInstance.getEndpoint(APIEndpointKeys.customCustomerLogin)!)).toBaseResponse(
fromJson: (json) => LoginResponseData.fromJson(json),
);
if (response.statusCode == 200) {}
// if (response.isSuccess == false) {
// return Failure(response.errorMessage ?? 'Failed to login');
// }
return Success(response.data);
// return Success(loginKpData);
} catch (err) {
throw handleApiError(err);
}
}