uopdate object to take in app_id
This commit is contained in:
@@ -105,8 +105,7 @@ class _PatientFilesState extends State<PatientFiles> {
|
|||||||
startDateController.clear();
|
startDateController.clear();
|
||||||
endDateTextController.clear();
|
endDateTextController.clear();
|
||||||
retDateTextController.clear();
|
retDateTextController.clear();
|
||||||
futueFiles =
|
futueFiles = fetchFiles();
|
||||||
fetchFiles(endpointFiles + widget.patientIndex.toString());
|
|
||||||
});
|
});
|
||||||
// end loading circle
|
// end loading circle
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
@@ -155,8 +154,7 @@ class _PatientFilesState extends State<PatientFiles> {
|
|||||||
if (response2.statusCode == 201) {
|
if (response2.statusCode == 201) {
|
||||||
setState(() {
|
setState(() {
|
||||||
selectedFileController.clear();
|
selectedFileController.clear();
|
||||||
futueFiles =
|
futueFiles = fetchFiles();
|
||||||
fetchFiles(endpointFiles + widget.patientIndex.toString());
|
|
||||||
});
|
});
|
||||||
// end loading circle
|
// end loading circle
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
@@ -171,31 +169,32 @@ class _PatientFilesState extends State<PatientFiles> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> getUserDetails() async {
|
// Future<void> getUserDetails() async {
|
||||||
await getUserEmail();
|
// await getUserEmail();
|
||||||
var response = await http.get(Uri.parse(endpointUser + userEmail));
|
// var response = await http.get(Uri.parse(endpointUser + userEmail));
|
||||||
//print(response.body);
|
// //print(response.body);
|
||||||
if (response.statusCode == 200) {
|
// if (response.statusCode == 200) {
|
||||||
appUser =
|
// appUser =
|
||||||
AppUser.fromJson(jsonDecode(response.body) as Map<String, dynamic>);
|
// AppUser.fromJson(jsonDecode(response.body) as Map<String, dynamic>);
|
||||||
} else {
|
// } else {
|
||||||
internetConnectionPopUp();
|
// internetConnectionPopUp();
|
||||||
throw Exception('Failed to load user');
|
// throw Exception('Failed to load user');
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
Future<void> getUserEmail() async {
|
// Future<void> getUserEmail() async {
|
||||||
// Add method to get user email
|
// // Add method to get user email
|
||||||
var uid = await SuperTokens.getUserId();
|
// var uid = await SuperTokens.getUserId();
|
||||||
var response = await http.get(Uri.parse("$baseAPI/user/$uid"));
|
// var response = await http.get(Uri.parse("$baseAPI/user/$uid"));
|
||||||
if (response.statusCode == 200) {
|
// if (response.statusCode == 200) {
|
||||||
var user = jsonDecode(response.body);
|
// var user = jsonDecode(response.body);
|
||||||
userEmail = user["email"];
|
// userEmail = user["email"];
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
Future<List<PFile>> fetchFiles(String endpoint) async {
|
Future<List<PFile>> fetchFiles() async {
|
||||||
final response = await http.get(Uri.parse(endpoint));
|
final response = await http.get(Uri.parse(
|
||||||
|
"${AppEnviroment.baseApiUrl}/files/patients/${widget.selectedPatient.app_id}"));
|
||||||
|
|
||||||
//print(response.statusCode);
|
//print(response.statusCode);
|
||||||
//print(response.body);
|
//print(response.body);
|
||||||
@@ -546,9 +545,9 @@ class _PatientFilesState extends State<PatientFiles> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
futueFiles = fetchFiles(endpointFiles + widget.patientIndex.toString());
|
futueFiles = fetchFiles();
|
||||||
//patientDetails = getPatientDetails() as Patient;
|
//patientDetails = getPatientDetails() as Patient;
|
||||||
getUserDetails();
|
//getUserDetails();
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user