loc-chain-app/loc_chain_app/lib/util/requests.dart
2021-04-11 01:32:49 -05:00

33 lines
866 B
Dart

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,
);
}