diff --git a/lib/common/apifunctions/submit_receipt_api.dart b/lib/common/apifunctions/submit_receipt_api.dart index d3a67c0..70c56f1 100644 --- a/lib/common/apifunctions/submit_receipt_api.dart +++ b/lib/common/apifunctions/submit_receipt_api.dart @@ -3,7 +3,7 @@ import 'dart:convert'; import 'package:flutter/material.dart'; import 'package:http/http.dart' as http; -import 'package:local_spend/common/functions/save_current_login.dart'; +import 'package:shared_preferences/shared_preferences.dart'; import 'package:local_spend/common/functions/show_dialog_single_button.dart'; import 'package:local_spend/model/json/login_model.dart'; import 'package:local_spend/config.dart'; @@ -13,11 +13,14 @@ import 'package:flutter/foundation.dart'; Future submitReceiptAPI( BuildContext context, String amount, String time) async { //var apiUrl = ConfigWrapper.of(context).apiKey; - final url = "https://dev.peartrade.org/api/login"; + final url = "https://dev.peartrade.org/api/upload"; + + SharedPreferences preferences = await SharedPreferences.getInstance(); Map body = { 'transaction_value': amount, 'purchase_time': time, + 'session_key': preferences.get('LastToken'), }; debugPrint('$body'); diff --git a/lib/pages/receipt_page.dart b/lib/pages/receipt_page.dart index 8fd05ac..b316ca7 100644 --- a/lib/pages/receipt_page.dart +++ b/lib/pages/receipt_page.dart @@ -104,6 +104,7 @@ class ReceiptPageState extends State { inputType: InputType.both, format: DateFormat("EEEE, MMMM d, yyyy 'at' h:mma"), editable: true, + controller: _timeController, decoration: InputDecoration( labelText: 'Date/Time of Transaction', hasFloatingPlaceholder: false), onChanged: (dt) => setState(() => date = dt), @@ -144,7 +145,7 @@ class ReceiptPageState extends State { submitReceiptAPI(context, _amountController.text, _timeController.text); }, - child: Text("LOGIN", + child: Text("SUBMIT", style: TextStyle(color: Colors.white, fontSize: 22.0)), color: Colors.blue, diff --git a/pubspec.lock b/pubspec.lock index c04c54c..ea96797 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -49,7 +49,7 @@ packages: name: build_daemon url: "https://pub.dartlang.org" source: hosted - version: "0.6.0" + version: "0.6.1" build_resolvers: dependency: transitive description: @@ -77,7 +77,7 @@ packages: name: built_collection url: "https://pub.dartlang.org" source: hosted - version: "4.2.1" + version: "4.2.2" built_value: dependency: transitive description: @@ -241,14 +241,14 @@ packages: name: json_annotation url: "https://pub.dartlang.org" source: hosted - version: "2.2.0" + version: "2.3.0" json_serializable: dependency: "direct dev" description: name: json_serializable url: "https://pub.dartlang.org" source: hosted - version: "2.2.2" + version: "2.3.0" kernel: dependency: transitive description: