35 lines
1.1 KiB
Dart
35 lines
1.1 KiB
Dart
|
import 'dart:convert';
|
||
|
|
||
|
import 'package:unit2/utils/request.dart';
|
||
|
import 'package:unit2/utils/urls.dart';
|
||
|
import 'package:http/http.dart' as http;
|
||
|
class EligibilityService{
|
||
|
static final EligibilityService _instance = EligibilityService();
|
||
|
static EligibilityService get instance => _instance;
|
||
|
|
||
|
Future<bool> delete({required int eligibilityId, required int profileId,required String token})async{
|
||
|
bool? success;
|
||
|
String Authtoken = "Token $token";
|
||
|
String path = "${Url.instance.deleteEligibility()}$profileId/";
|
||
|
Map body = { "eligibility_id": eligibilityId};
|
||
|
Map<String, dynamic> params ={"force_mode":"true"};
|
||
|
Map<String, String> headers = {
|
||
|
'Content-Type': 'application/json; charset=UTF-8',
|
||
|
'Authorization': "Token $token"
|
||
|
};
|
||
|
// try{
|
||
|
http.Response response = await Request.instance.deleteRequest(path: path, headers: headers, body: body, param: params);
|
||
|
if(response.statusCode == 200){
|
||
|
Map data = jsonDecode(response.body);
|
||
|
success = data['success'];
|
||
|
}else{
|
||
|
success = false;
|
||
|
}
|
||
|
|
||
|
// }catch(e){
|
||
|
// throw(e.toString());
|
||
|
// }
|
||
|
return success!;
|
||
|
}
|
||
|
|
||
|
}
|