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.

changeprofileimage_post.dart 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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 ChangeProfileImage_Post {
  8. late String session;
  9. late String imageBase64;
  10. ChangeProfileImage_Post({required this.session,
  11. required this.imageBase64});
  12. static Future<String> connectToAPI(String session, String imageBase64) async {
  13. String URL = baseURL + "/api/v1/change_profile";
  14. final SharedPreferences prefs = await SharedPreferences.getInstance();
  15. final session = prefs.getString('session');
  16. var sendData = await http.post(Uri.parse(URL), body: jsonEncode({
  17. "data": [
  18. {
  19. "session": session,
  20. "image": imageBase64,
  21. }
  22. ]
  23. }), headers: {
  24. "Content-Type": "application/json",
  25. "Api-key": apiKey
  26. });
  27. return sendData.body;
  28. /*var jsonObject = json.decode(sendData.body);
  29. developer.log(jsonObject.toString(), name: 'Log');*/
  30. // return jsonObject;
  31. // return LoginPostResult.createPostResult(jsonObject);
  32. }
  33. }