提交 49eae89f authored 作者: shixiaochen's avatar shixiaochen

1、网络请求兼容code整形、字符串判断;

上级 6eb76a1e
...@@ -32,3 +32,6 @@ ...@@ -32,3 +32,6 @@
* SearchAppBar增加leadingWidth属性 * SearchAppBar增加leadingWidth属性
* ## 1.1.6 * ## 1.1.6
* MyPageAppBar增加titleSpacing属性 * MyPageAppBar增加titleSpacing属性
* ## 1.1.7
* 网络请求兼容code整形、字符串判断
\ No newline at end of file
...@@ -131,10 +131,8 @@ abstract class BaseDio { ...@@ -131,10 +131,8 @@ abstract class BaseDio {
data: data, data: data,
options: _checkOptions(method.value, options), options: _checkOptions(method.value, options),
); );
if (response.data['code'] == 100 || var responseCode = response.data['code']?.toString();
response.data['code'] == "100" || if (responseCode == "100" || responseCode == "-100") {
response.data['code'] == -100 ||
response.data['code'] == "-100") {
logger.e("登录过期:${response.data['msg']}"); logger.e("登录过期:${response.data['msg']}");
onLoginExpire(); onLoginExpire();
} }
...@@ -156,7 +154,8 @@ abstract class BaseDio { ...@@ -156,7 +154,8 @@ abstract class BaseDio {
Response response, Response response,
NetSuccessCallback successCallback, NetSuccessCallback successCallback,
NetErrorCallback? errorCallback) async { NetErrorCallback? errorCallback) async {
if (response.data['code'] == 100 || response.data['code'] == "100") { var responseCode = response.data['code']?.toString();
if (responseCode == "100" || responseCode == "-100") {
logger.e("登录过期:${response.data['msg']}"); logger.e("登录过期:${response.data['msg']}");
onLoginExpire(); onLoginExpire();
return; return;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论