v1.0.26 no webapi
This commit is contained in:
parent
391551f57b
commit
652104b403
@ -1,5 +1,9 @@
|
|||||||
Workout Test and Diet 4 You Common Util Functions
|
Workout Test and Diet 4 You Common Util Functions
|
||||||
|
|
||||||
|
### Version 1.0.26
|
||||||
|
|
||||||
|
- no more webapi
|
||||||
|
|
||||||
### Version 1.0.25
|
### Version 1.0.25
|
||||||
|
|
||||||
- http get utf8
|
- http get utf8
|
||||||
|
@ -21,7 +21,7 @@ class APIClient with Common, Logging {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dynamic authenticateUser(String email, String password) async {
|
dynamic authenticateUser(String email, String password) async {
|
||||||
if ( kIsWeb ) {
|
if (kIsWeb) {
|
||||||
APIWebClient webClient = APIWebClient();
|
APIWebClient webClient = APIWebClient();
|
||||||
return webClient.authenticateUser(email, password);
|
return webClient.authenticateUser(email, password);
|
||||||
}
|
}
|
||||||
@ -36,10 +36,7 @@ class APIClient with Common, Logging {
|
|||||||
request.headers.contentType = ContentType('application', 'json', charset: 'utf-8');
|
request.headers.contentType = ContentType('application', 'json', charset: 'utf-8');
|
||||||
request.headers.set('Authorization', '1');
|
request.headers.set('Authorization', '1');
|
||||||
|
|
||||||
final body = jsonEncode(<String, String>{
|
final body = jsonEncode(<String, String>{'username': email, 'password': password});
|
||||||
'username': email,
|
|
||||||
'password': password
|
|
||||||
});
|
|
||||||
|
|
||||||
request.write(body);
|
request.write(body);
|
||||||
HttpClientResponse result = await request.close();
|
HttpClientResponse result = await request.close();
|
||||||
@ -66,10 +63,10 @@ class APIClient with Common, Logging {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<String> post(String endPoint, String body) async {
|
Future<String> post(String endPoint, String body) async {
|
||||||
if ( kIsWeb ) {
|
/*if ( kIsWeb ) {
|
||||||
APIWebClient webClient = APIWebClient();
|
APIWebClient webClient = APIWebClient();
|
||||||
return webClient.post(endPoint, body);
|
return webClient.post(endPoint, body);
|
||||||
}
|
}*/
|
||||||
final url = Cache().getBaseUrl() + endPoint;
|
final url = Cache().getBaseUrl() + endPoint;
|
||||||
log(" ------------ http/post body $body - url: $url ");
|
log(" ------------ http/post body $body - url: $url ");
|
||||||
try {
|
try {
|
||||||
@ -99,7 +96,7 @@ class APIClient with Common, Logging {
|
|||||||
} else {
|
} else {
|
||||||
throw Exception("Network Error, please try again later");
|
throw Exception("Network Error, please try again later");
|
||||||
}
|
}
|
||||||
} on NotFoundException catch(e) {
|
} on NotFoundException catch (e) {
|
||||||
throw NotFoundException(message: "Not Found ${e.message}");
|
throw NotFoundException(message: "Not Found ${e.message}");
|
||||||
} on Exception catch (e) {
|
} on Exception catch (e) {
|
||||||
log("Post Exception: $e");
|
log("Post Exception: $e");
|
||||||
@ -109,10 +106,10 @@ class APIClient with Common, Logging {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<String> get(String endPoint, String param) async {
|
Future<String> get(String endPoint, String param) async {
|
||||||
if ( kIsWeb ) {
|
/*if ( kIsWeb ) {
|
||||||
APIWebClient webClient = APIWebClient();
|
APIWebClient webClient = APIWebClient();
|
||||||
return webClient.get(endPoint, param);
|
return webClient.get(endPoint, param);
|
||||||
}
|
}*/
|
||||||
final url = Cache().getBaseUrl() + endPoint + param;
|
final url = Cache().getBaseUrl() + endPoint + param;
|
||||||
try {
|
try {
|
||||||
log("-------- API get $url");
|
log("-------- API get $url");
|
||||||
@ -140,7 +137,7 @@ class APIClient with Common, Logging {
|
|||||||
} else {
|
} else {
|
||||||
throw Exception("Network Error, please try again later");
|
throw Exception("Network Error, please try again later");
|
||||||
}
|
}
|
||||||
} on NotFoundException catch(e) {
|
} on NotFoundException catch (e) {
|
||||||
throw NotFoundException(message: "Not Found ${e.message}");
|
throw NotFoundException(message: "Not Found ${e.message}");
|
||||||
} on Exception catch (e) {
|
} on Exception catch (e) {
|
||||||
log("Post Exception: $e");
|
log("Post Exception: $e");
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
name: workouttest_util
|
name: workouttest_util
|
||||||
description: Workout Test app and web functions.
|
description: Workout Test app and web functions.
|
||||||
version: 1.0.25
|
version: 1.0.26
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.18.6 <3.0.0"
|
sdk: ">=2.18.6 <3.0.0"
|
||||||
|
Loading…
Reference in New Issue
Block a user