forked from yaso_meth/mih-project
Fix patient file api call issue
This commit is contained in:
@@ -45,32 +45,28 @@ class _BuildFilesListState extends State<BuildFilesList> {
|
||||
String fileUrl = "";
|
||||
|
||||
Future<String> getFileUrlApiCall(String filePath) async {
|
||||
if (AppEnviroment.getEnv() == "Dev") {
|
||||
return "$basefile/mih/$filePath";
|
||||
var url = "$baseAPI/minio/pull/file/${AppEnviroment.getEnv()}/$filePath";
|
||||
//print(url);
|
||||
var response = await http.get(Uri.parse(url));
|
||||
// print("here1");
|
||||
//print(response.statusCode);
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
//print("here2");
|
||||
String body = response.body;
|
||||
//print(body);
|
||||
//print("here3");
|
||||
var decodedData = jsonDecode(body);
|
||||
//print("Dedoced: ${decodedData['minioURL']}");
|
||||
|
||||
return decodedData['minioURL'];
|
||||
//AppUser u = AppUser.fromJson(decodedData);
|
||||
// print(u.email);
|
||||
//return "AlometThere";
|
||||
} else {
|
||||
var url = "$baseAPI/minio/pull/file/$filePath/prod";
|
||||
//print(url);
|
||||
var response = await http.get(Uri.parse(url));
|
||||
// print("here1");
|
||||
//print(response.statusCode);
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
//print("here2");
|
||||
String body = response.body;
|
||||
//print(body);
|
||||
//print("here3");
|
||||
var decodedData = jsonDecode(body);
|
||||
//print("Dedoced: ${decodedData['minioURL']}");
|
||||
|
||||
return decodedData['minioURL'];
|
||||
//AppUser u = AppUser.fromJson(decodedData);
|
||||
// print(u.email);
|
||||
//return "AlometThere";
|
||||
} else {
|
||||
throw Exception(
|
||||
"Error: GetUserData status code ${response.statusCode}");
|
||||
}
|
||||
throw Exception("Error: GetUserData status code ${response.statusCode}");
|
||||
}
|
||||
|
||||
//print(url);
|
||||
// var response = await http.get(Uri.parse(url));
|
||||
// // print("here1");
|
||||
|
||||
@@ -98,76 +98,6 @@ class _HomeState extends State<Home> {
|
||||
return HomeArguments(userData, bUserData, busData, userPic);
|
||||
}
|
||||
|
||||
Future<AppUser> getUserDetails() async {
|
||||
//print("pat man drawer: " + endpointUserData + widget.userEmail);
|
||||
var uid = await SuperTokens.getUserId();
|
||||
var response = await http.get(Uri.parse("$baseAPI/user/$uid"));
|
||||
|
||||
// print(response.statusCode);
|
||||
// print(response.body);
|
||||
if (response.statusCode == 200) {
|
||||
// print("here");
|
||||
String body = response.body;
|
||||
var decodedData = jsonDecode(body);
|
||||
AppUser u = AppUser.fromJson(decodedData);
|
||||
// print(u.email);
|
||||
//setState(() {
|
||||
//_widgetOptions = setLayout(u);
|
||||
//});
|
||||
return u;
|
||||
} else {
|
||||
throw Exception("Error: GetUserData status code ${response.statusCode}");
|
||||
}
|
||||
}
|
||||
|
||||
Future<BusinessUser?> getBusinessUserDetails() async {
|
||||
var uid = await SuperTokens.getUserId();
|
||||
var response = await http.get(Uri.parse("$baseAPI/business-user/$uid"));
|
||||
if (response.statusCode == 200) {
|
||||
String body = response.body;
|
||||
var decodedData = jsonDecode(body);
|
||||
BusinessUser business_User = BusinessUser.fromJson(decodedData);
|
||||
return business_User;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Future<Business?> getBusinessDetails() async {
|
||||
var uid = await SuperTokens.getUserId();
|
||||
var response = await http.get(Uri.parse("$baseAPI/business/app_id/$uid"));
|
||||
if (response.statusCode == 200) {
|
||||
String body = response.body;
|
||||
var decodedData = jsonDecode(body);
|
||||
Business business = Business.fromJson(decodedData);
|
||||
return business;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Future<String> getFileUrlApiCall(AppUser signedInUser) async {
|
||||
if (signedInUser.pro_pic_path == "") {
|
||||
return "";
|
||||
} else if (AppEnviroment.getEnv() == "Dev") {
|
||||
return "${AppEnviroment.baseFileUrl}/mih/${signedInUser.pro_pic_path}";
|
||||
} else {
|
||||
var url =
|
||||
"${AppEnviroment.baseApiUrl}/minio/pull/file/${signedInUser.pro_pic_path}/prod";
|
||||
var response = await http.get(Uri.parse(url));
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
String body = response.body;
|
||||
var decodedData = jsonDecode(body);
|
||||
|
||||
return decodedData['minioURL'];
|
||||
} else {
|
||||
throw Exception(
|
||||
"Error: GetUserData status code ${response.statusCode}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
// TODO: implement dispose
|
||||
|
||||
Reference in New Issue
Block a user