Skip to content

Commit

Permalink
Save response
Browse files Browse the repository at this point in the history
  • Loading branch information
dewmal committed Mar 22, 2020
1 parent dbfe407 commit ac13891
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/constants.dart
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
final bool debugRelease = true;
final String testingServer = "http://api.covid-19.health.gov.lk/test";
final String testingServer = "https://api.covid-19.health.gov.lk/test";
8 changes: 4 additions & 4 deletions lib/networking/db.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import 'package:selftrackingapp/models/news_article.dart';
import 'package:selftrackingapp/models/registration.dart';
import 'package:selftrackingapp/models/reported_case.dart';
import 'package:http/http.dart' as http;
import 'package:shared_preferences/shared_preferences.dart';

import '../constants.dart';

Expand Down Expand Up @@ -101,11 +102,10 @@ class AppDatabase implements DB {
print(basicAuth);
Response response = await http.post(url,
body: registration.toJson(),
headers: {
"Content-Type": "application/json",
'authorization': basicAuth
});
headers: {"Content-Type": "application/json"});
if (response.statusCode == 200) {
SharedPreferences prefs = await SharedPreferences.getInstance();
prefs.setString("register_id", utf8.decode(response.bodyBytes));
print("Registered User Successfully");
return;
} else {
Expand Down

0 comments on commit ac13891

Please sign in to comment.