No Description
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.

getProfileImage_post.dart 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. import 'dart:convert';
  2. import 'dart:core';
  3. import 'package:http/http.dart' as http;
  4. import 'package:hris_selfservice_mobile/constants.dart';
  5. import 'dart:developer' as developer;
  6. import 'package:shared_preferences/shared_preferences.dart';
  7. class GetProfileImage_Post {
  8. late String session;
  9. GetProfileImage_Post({required this.session});
  10. static Future<String> connectToAPI(String session) async {
  11. String URL = baseURL + "/api/v1/get_image";
  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: "sendatabody");
  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. }