123456789101112131415161718192021222324252627282930313233343536373839 |
- 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 Logout_Post {
- late String session;
-
- Logout_Post({required this.session});
-
- static Future<String> connectToAPI() async {
- String URL = baseURL + "/api/v1/logout";
-
- final SharedPreferences prefs = await SharedPreferences.getInstance();
- final session = prefs.getString('session');
-
- var sendData = await http.post(Uri.parse(URL), body: jsonEncode({
- "data": [
- {
- "session": session
- }
- ]
- }), headers: {
- "Content-Type": "application/json",
- "Api-key": apiKey
- });
-
- developer.log(sendData.body, name: "sendatabody");
- return sendData.body;
-
- /*var jsonObject = json.decode(sendData.body);
- developer.log(jsonObject.toString(), name: 'Log');*/
- // return jsonObject;
- // return LoginPostResult.createPostResult(jsonObject);
- }
- }
|