added requests

This commit is contained in:
Zachary Atkins 2021-04-11 01:32:49 -05:00
parent d56bad22d0
commit fc08292542
3 changed files with 54 additions and 0 deletions

View File

@ -0,0 +1,32 @@
import 'dart:convert';
import 'dart:html';
import 'dart:io';
import 'package:http/http.dart' as http;
import 'package:loc_chain_app/util/transaction_manager.dart';
String baseUrl = 'http://loc.glmdev.tech:8000/';
Future<http.Response> postEncounter(EncounterTransaction encounter) async {
var payload = jsonEncode(encounter);
var url = Uri.parse('http://loc.glmdev.tech:8000/api/v1/encounter');
return await http.post(
url,
headers: <String, String>{
'Content-Type': 'application/json',
},
body: payload,
);
}
Future<http.Response> postExposure(ExposureTransaction exposure) async {
var payload = jsonEncode(exposure);
var url = Uri.parse('http://loc.glmdev.tech:8000/api/v1/exposure');
return await http.post(
url,
headers: <String, String>{
'Content-Type': 'application/json',
},
body: payload,
);
}

View File

@ -121,6 +121,20 @@ packages:
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.0" version: "0.0.0"
http:
dependency: "direct main"
description:
name: http
url: "https://pub.dartlang.org"
source: hosted
version: "0.13.1"
http_parser:
dependency: transitive
description:
name: http_parser
url: "https://pub.dartlang.org"
source: hosted
version: "4.0.0"
js: js:
dependency: transitive dependency: transitive
description: description:
@ -205,6 +219,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.0" version: "2.0.0"
pedantic:
dependency: transitive
description:
name: pedantic
url: "https://pub.dartlang.org"
source: hosted
version: "1.11.0"
platform: platform:
dependency: transitive dependency: transitive
description: description:

View File

@ -36,6 +36,7 @@ dependencies:
flutter_udid: ^2.0.0 flutter_udid: ^2.0.0
loading_animations: ^2.2.0 loading_animations: ^2.2.0
openpgp: ^2.0.0-nullsafety.0 openpgp: ^2.0.0-nullsafety.0
http: ^0.13.1
dev_dependencies: dev_dependencies:
flutter_test: flutter_test: