import 'dart:convert'; import 'dart:core'; import 'package:http/http.dart' as http; import 'package:employee_selfservice_mobile/constants.dart'; import 'dart:developer' as developer; import 'package:shared_preferences/shared_preferences.dart'; class DownloadSlipGaji_Post { late String batch_id; late String session; DownloadSlipGaji_Post({required this.session}); static Future connectToAPI(String batch_id) async { String URL = baseURL + "/api/v1/download_slip"; final SharedPreferences prefs = await SharedPreferences.getInstance(); final session = prefs.getString('session'); var sendData = await http.post(Uri.parse(URL), body: jsonEncode({ "data": [ { "batch_id" : batch_id, "session" : session } ] }), headers: { "Content-Type": "application/json", "Api-key": apiKey }); developer.log(sendData.body, name: "Download Slip Gaji Result"); return sendData.body; } }