Nessuna descrizione
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

getDetail_post.dart 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. import 'dart:convert';
  2. import 'dart:core';
  3. import 'package:http/http.dart' as http;
  4. import 'package:employee_selfservice_mobile/constants.dart';
  5. import 'dart:developer' as developer;
  6. import 'package:shared_preferences/shared_preferences.dart';
  7. class GetDetail_Post {
  8. late String session;
  9. GetDetail_Post({required this.session});
  10. static Future<String> connectToAPI() async {
  11. String URL = baseURL + "/api/v1/get_detail";
  12. final SharedPreferences prefs = await SharedPreferences.getInstance();
  13. final session = prefs.getString('session');
  14. var sendData = await http.post(Uri.parse(URL), body: jsonEncode({
  15. "data": [
  16. {
  17. "session": session
  18. }
  19. ]
  20. }), headers: {
  21. "Content-Type": "application/json",
  22. "Api-key": apiKey
  23. });
  24. developer.log(sendData.body, name: "Get Detail Result");
  25. return sendData.body;
  26. /*var jsonObject = json.decode(sendData.body);
  27. developer.log(jsonObject.toString(), name: 'Log');*/
  28. // return jsonObject;
  29. // return LoginPostResult.createPostResult(jsonObject);
  30. }
  31. }