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.

changePassword_post.dart 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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 ChangePassword_Post {
  8. late String password;
  9. late String new_password;
  10. late String session;
  11. ChangePassword_Post({required this.password, required this.new_password, required this.session});
  12. static Future<String> connectToAPI(String password, String new_password) async {
  13. String URL = baseURL + "/api/v1/change_password";
  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. "password": password,
  20. "new_password": new_password,
  21. "session": session
  22. }
  23. ]
  24. }), headers: {
  25. "Content-Type": "application/json",
  26. "Api-key": apiKey
  27. });
  28. developer.log(sendData.toString(), name: "sendatabody");
  29. return sendData.body;
  30. /*var jsonObject = json.decode(sendData.body);
  31. developer.log(jsonObject.toString(), name: 'Log');*/
  32. // return jsonObject;
  33. // return LoginPostResult.createPostResult(jsonObject);
  34. }
  35. }