Skip to content

Commit 7814de6

Browse files
committed
Included apiKey in header to connect with updated backend
1 parent aed35da commit 7814de6

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ app.*.symbols
4141
# Obfuscation related
4242
app.*.map.json
4343

44+
/lib/secrets.dart
45+
4446
# Android Studio will place build artifacts here
4547
/android/app/debug
4648
/android/app/profile

lib/services/user_contract_service.dart

+11-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import 'package:web_socket_channel/io.dart';
77
import 'package:http/http.dart' as http;
88

99
import '../config.dart';
10+
import '../secrets.dart';
1011

1112
class UserContractService{
1213

@@ -20,6 +21,10 @@ class UserContractService{
2021
}) async{
2122
// return the address of deployed contract
2223
final response = await http.post(Uri.parse("${Config.backendUrl}/contract"),
24+
headers: {
25+
"apiKey" : APIKEY,
26+
"Content-Type": "application/json"
27+
},
2328
body: {
2429
"name": name,
2530
"email": email,
@@ -42,7 +47,12 @@ class UserContractService{
4247

4348
Future<Object> getAbi() async{
4449
// get the abi from calling the application backend
45-
final response = await http.get(Uri.parse("${Config.backendUrl}/contract"));
50+
final response = await http.get(
51+
Uri.parse("${Config.backendUrl}/contract"),
52+
headers: {
53+
"apiKey" : APIKEY
54+
}
55+
);
4656
if(response.statusCode == 200){
4757
var responseJson = jsonDecode(response.body);
4858
return responseJson['data'];

0 commit comments

Comments
 (0)