Ei kuvausta
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.

loginstatus_post.dart 1.0KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import 'dart:convert';
  2. import 'dart:core';
  3. import 'package:http/http.dart' as http;
  4. import 'package:tower_app/constants.dart';
  5. import 'dart:developer' as logDev;
  6. class LoginStatus_Post {
  7. late String version;
  8. late String device;
  9. late String session;
  10. late String notif_token;
  11. LoginStatus_Post({
  12. required this.version,
  13. required this.device,
  14. required this.session,
  15. required this.notif_token});
  16. static Future<String> connectToAPI(String version, String device, String session, String notif_token) async {
  17. String URL = baseURL + "/api/v1/login_status";
  18. print(URL);
  19. var sendData = await http.post(Uri.parse(URL),
  20. body: jsonEncode({
  21. "data": [
  22. {
  23. "version": version,
  24. "device": device,
  25. "session": session,
  26. "notif_token": notif_token
  27. }
  28. ]
  29. }),
  30. headers: {"Content-Type": "application/json", "Api-key": apiKey});
  31. logDev.log(sendData.body, name: "Login Status");
  32. return sendData.body;
  33. }
  34. }