12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- 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 PengajuanCuti_Post {
- late String session;
- late String tipe;
- late String date_from;
- late String date_to;
- late String deskripsi;
- late List<String> file;
-
- PengajuanCuti_Post({required this.session});
-
- static Future<String> connectToAPI(String tipe, String date_from, String date_to, String deskripsi, List<String> file) async {
- String URL = baseURL + "/api/v1/pengajuan_cuti";
-
- final SharedPreferences prefs = await SharedPreferences.getInstance();
- final session = prefs.getString('session');
-
- var sendData = await http.post(Uri.parse(URL), body: jsonEncode({
- "data": [
- {
- "session": session,
- "tipe" : tipe,
- "date_from" : date_from,
- "date_to" : date_to,
- "deskripsi" : deskripsi,
- "file" : file
- }
- ]
- }), headers: {
- "Content-Type": "application/json",
- "Api-key": apiKey
- });
-
- developer.log(sendData.body, name: "Get Jenis Cuti Result");
- return sendData.body;
-
- /*var jsonObject = json.decode(sendData.body);
- developer.log(jsonObject.toString(), name: 'Log');*/
- // return jsonObject;
- // return LoginPostResult.createPostResult(jsonObject);
- }
- }
|