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