47 lines
1.4 KiB
Dart
47 lines
1.4 KiB
Dart
import 'dart:developer';
|
|
|
|
import 'package:dio/dio.dart';
|
|
|
|
import '../../Utils/api_urls.dart';
|
|
import '../../Utils/base_manager.dart';
|
|
import '../../data/network/network_api_services.dart';
|
|
|
|
class RiskProfileApi {
|
|
Future<ResponseData<dynamic>> getRiskProfileData() async {
|
|
final response = await NetworkApiServices()
|
|
.getApi(ApiUrls.getRiskProfileQuestionAnswerApi, isAuth: true);
|
|
log(response.data.toString());
|
|
if (response.status == ResponseStatus.SUCCESS) {
|
|
Map<String, dynamic> responseData =
|
|
Map<String, dynamic>.from(response.data);
|
|
if (responseData['status'] == "success") {
|
|
return response;
|
|
} else {
|
|
return ResponseData<dynamic>(
|
|
responseData['message'], ResponseStatus.FAILED);
|
|
}
|
|
}
|
|
return response;
|
|
}
|
|
|
|
Future<ResponseData<dynamic>> addRiskProfileData(FormData data) async {
|
|
final response = await NetworkApiServices().postApi(
|
|
data,
|
|
ApiUrls.addRiskProfileQuestionAnswerApi,
|
|
isAuth: true,
|
|
);
|
|
log(response.data.toString());
|
|
if (response.status == ResponseStatus.SUCCESS) {
|
|
Map<String, dynamic> responseData =
|
|
Map<String, dynamic>.from(response.data);
|
|
if (responseData['status'] == "success") {
|
|
return response;
|
|
} else {
|
|
return ResponseData<dynamic>(
|
|
responseData['message'], ResponseStatus.FAILED);
|
|
}
|
|
}
|
|
return response;
|
|
}
|
|
}
|