1234567891011121314151617181920212223242526272829303132333435363738394041 |
- import 'dart:convert';
- import 'dart:core';
- import 'package:http/http.dart' as http;
- import 'package:hris_selfservice_mobile/constants.dart';
- import 'dart:developer' as developer;
-
- import 'package:shared_preferences/shared_preferences.dart';
-
- class ChangeProfileImage_Post {
- late String session;
- late String imageBase64;
-
- ChangeProfileImage_Post({required this.session,
- required this.imageBase64});
-
- static Future<String> connectToAPI(String session, String imageBase64) async {
- String URL = baseURL + "/api/v1/change_profile";
-
- final SharedPreferences prefs = await SharedPreferences.getInstance();
- final session = prefs.getString('session');
-
- var sendData = await http.post(Uri.parse(URL), body: jsonEncode({
- "data": [
- {
- "session": session,
- "image": imageBase64,
- }
- ]
- }), headers: {
- "Content-Type": "application/json",
- "Api-key": apiKey
- });
-
- return sendData.body;
-
- /*var jsonObject = json.decode(sendData.body);
- developer.log(jsonObject.toString(), name: 'Log');*/
- // return jsonObject;
- // return LoginPostResult.createPostResult(jsonObject);
- }
- }
|