Fix patient file api call issue
This commit is contained in:
@@ -45,10 +45,7 @@ class _BuildFilesListState extends State<BuildFilesList> {
|
|||||||
String fileUrl = "";
|
String fileUrl = "";
|
||||||
|
|
||||||
Future<String> getFileUrlApiCall(String filePath) async {
|
Future<String> getFileUrlApiCall(String filePath) async {
|
||||||
if (AppEnviroment.getEnv() == "Dev") {
|
var url = "$baseAPI/minio/pull/file/${AppEnviroment.getEnv()}/$filePath";
|
||||||
return "$basefile/mih/$filePath";
|
|
||||||
} else {
|
|
||||||
var url = "$baseAPI/minio/pull/file/$filePath/prod";
|
|
||||||
//print(url);
|
//print(url);
|
||||||
var response = await http.get(Uri.parse(url));
|
var response = await http.get(Uri.parse(url));
|
||||||
// print("here1");
|
// print("here1");
|
||||||
@@ -67,10 +64,9 @@ class _BuildFilesListState extends State<BuildFilesList> {
|
|||||||
// print(u.email);
|
// print(u.email);
|
||||||
//return "AlometThere";
|
//return "AlometThere";
|
||||||
} else {
|
} else {
|
||||||
throw Exception(
|
throw Exception("Error: GetUserData status code ${response.statusCode}");
|
||||||
"Error: GetUserData status code ${response.statusCode}");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//print(url);
|
//print(url);
|
||||||
// var response = await http.get(Uri.parse(url));
|
// var response = await http.get(Uri.parse(url));
|
||||||
// // print("here1");
|
// // print("here1");
|
||||||
|
|||||||
@@ -98,76 +98,6 @@ class _HomeState extends State<Home> {
|
|||||||
return HomeArguments(userData, bUserData, busData, userPic);
|
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
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
// TODO: implement dispose
|
// TODO: implement dispose
|
||||||
|
|||||||
Reference in New Issue
Block a user