Geen omschrijving
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.

getAll_post.dart 915B

1234567891011121314151617181920212223242526272829303132333435
  1. import 'dart:convert';
  2. import 'dart:core';
  3. import 'package:flutter/material.dart';
  4. import 'package:http/http.dart' as http;
  5. import 'package:employee_selfservice_mobile/constants.dart';
  6. import 'dart:developer' as developer;
  7. import 'package:shared_preferences/shared_preferences.dart';
  8. class GetAll_Post {
  9. late int user_id;
  10. GetAll_Post({required this.user_id});
  11. static Future<String> connectToAPI(int user_id) async {
  12. String URL = baseURL + "/api/get_all";
  13. final SharedPreferences prefs = await SharedPreferences.getInstance();
  14. final session = prefs.getString('session');
  15. var sendData = await http.post(Uri.parse(URL), body: jsonEncode({
  16. "data": [
  17. {
  18. "user_id": user_id
  19. }
  20. ]
  21. }), headers: {
  22. "Content-Type": "application/json",
  23. "Api-key": apiKey
  24. });
  25. //developer.log(sendData.body, name: "GET ALL");
  26. return sendData.body;
  27. }
  28. }