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.2KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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 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, String session) async {
  13. String URL = baseURL + "/api/v1/change_password";
  14. var sendData = await http.post(Uri.parse(URL), body: jsonEncode({
  15. "data": [
  16. {
  17. "password": password,
  18. "new_password": new_password,
  19. "session": session
  20. }
  21. ]
  22. }), headers: {
  23. "Content-Type": "application/json",
  24. "Api-key": apiKey
  25. });
  26. developer.log(sendData.toString(), name: "sendatabody");
  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. }