risk profile api
This commit is contained in:
@@ -13,7 +13,7 @@ class NetworkApiServices extends BaseApiServices {
|
||||
Dio dio = Dio();
|
||||
|
||||
@override
|
||||
Future<ResponseData> getApi(String url) async {
|
||||
Future<ResponseData> getApi(String url, {bool isAuth = false}) async {
|
||||
if (kDebugMode) {
|
||||
print("api url is >>> $url");
|
||||
}
|
||||
@@ -22,14 +22,10 @@ class NetworkApiServices extends BaseApiServices {
|
||||
String? token = prefs.getString('token').toString();
|
||||
log(token);
|
||||
try {
|
||||
response = await dio.get(
|
||||
url,
|
||||
// options: Options(headers: {
|
||||
// 'authorization': "Bearer $token",
|
||||
|
||||
// // "device-id": deviceId
|
||||
// })
|
||||
);
|
||||
response = await dio.get(url,
|
||||
options: Options(headers: {
|
||||
isAuth ? 'authorization' : "Bearer $token": "",
|
||||
}));
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
return ResponseData<dynamic>(
|
||||
@@ -58,7 +54,7 @@ class NetworkApiServices extends BaseApiServices {
|
||||
}
|
||||
|
||||
@override
|
||||
Future<ResponseData> postApi(data, String url) async {
|
||||
Future<ResponseData> postApi(data, String url, {bool isAuth = false}) async {
|
||||
if (kDebugMode) {
|
||||
print("data >>> $data");
|
||||
print("api url is >>> $url");
|
||||
@@ -70,17 +66,9 @@ class NetworkApiServices extends BaseApiServices {
|
||||
try {
|
||||
response = await dio.post(url,
|
||||
data: data,
|
||||
options: (token == null || token == "")
|
||||
? Options(
|
||||
headers: {
|
||||
"Authorization":
|
||||
"Basic KzIkcVBiSlIzNncmaGUoalMmV0R6ZkpqdEVoSlVLVXA6dCRCZHEmSnQmc3Y0eUdqY0VVcTg5aEVZZHVSalhIMnU=",
|
||||
},
|
||||
)
|
||||
: Options(headers: {
|
||||
"Authorization": "Bearer $token",
|
||||
//'access-token': token,
|
||||
}));
|
||||
options: Options(headers: {
|
||||
isAuth ? 'authorization' : "Bearer $token": "",
|
||||
}));
|
||||
} on Exception catch (e) {
|
||||
if (e is DioException) {
|
||||
log(e.response.toString());
|
||||
|
||||
Reference in New Issue
Block a user