update patientview call to take in signed in user & remove prints

This commit is contained in:
2024-07-26 13:43:43 +02:00
parent bd6ff29652
commit 903e07a901

View File

@@ -24,19 +24,19 @@ class _AddOrViewPatientState extends State<AddOrViewPatient> {
//print("Patien manager page: $endpoint"); //print("Patien manager page: $endpoint");
final response = await http.get(Uri.parse( final response = await http.get(Uri.parse(
"${AppEnviroment.baseApiUrl}/patients/${widget.signedInUser.app_id}")); "${AppEnviroment.baseApiUrl}/patients/${widget.signedInUser.app_id}"));
print("Here"); // print("Here");
print("Body: ${response.body}"); // print("Body: ${response.body}");
print("Code: ${response.statusCode}"); // print("Code: ${response.statusCode}");
// var errorCode = response.statusCode.toString(); // var errorCode = response.statusCode.toString();
// var errorBody = response.body; // var errorBody = response.body;
if (response.statusCode == 200) { if (response.statusCode == 200) {
print("Here1"); // print("Here1");
var decodedData = jsonDecode(response.body); var decodedData = jsonDecode(response.body);
print("Here2"); // print("Here2");
Patient patients = Patient.fromJson(decodedData as Map<String, dynamic>); Patient patients = Patient.fromJson(decodedData as Map<String, dynamic>);
print("Here3"); // print("Here3");
print(patients); // print(patients);
return patients; return patients;
} }
return null; return null;
@@ -55,7 +55,7 @@ class _AddOrViewPatientState extends State<AddOrViewPatient> {
if (snapshot.hasData) { if (snapshot.hasData) {
// Extracting data from snapshot object // Extracting data from snapshot object
//final data = snapshot.data as String; //final data = snapshot.data as String;
return PatientView(selectedPatient: snapshot.data!); return PatientView(signedInUser: widget.signedInUser);
} }
} }
return AddPatient(signedInUser: widget.signedInUser); return AddPatient(signedInUser: widget.signedInUser);