Няма описание
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.

filingData_post.dart 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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 FilingData_Post {
  9. late String id;
  10. late String amount;
  11. late String kk;
  12. late String ktp;
  13. late String npwp;
  14. late int user_id;
  15. FilingData_Post({required this.amount, required this.kk, required this.ktp, required this.npwp});
  16. static Future<String> connectToAPI(String id, String amount, String kk, String ktp, String npwp, int user_id) async {
  17. String URL = baseURL + "/api/filing_data";
  18. final SharedPreferences prefs = await SharedPreferences.getInstance();
  19. var sendData = await http.post(Uri.parse(URL), body: jsonEncode({
  20. "data": [
  21. {
  22. "id": id,
  23. "amount": amount,
  24. "kk": kk,
  25. "ktp": ktp,
  26. "npwp": npwp,
  27. "user_id": user_id
  28. }
  29. ]
  30. }), headers: {
  31. "Content-Type": "application/json",
  32. "Api-key": apiKey
  33. });
  34. //developer.log(sendData.body, name: "GET ALL");
  35. return sendData.body;
  36. }
  37. }