fix(account): 本地化网络异常文案
This commit is contained in:
1 parent
9b3ab9d5de
commit
27ab7cebfb
5 files changed
+90
-11
No files matched your search
@@ -24,9 +24,7 @@ class AccountDevicesLogic extends ChangeNotifier {
|
||||
try {
|
||||
devices = await _repository.devices();
|
||||
} catch (failure) {
|
||||
error = failure is ApiException
|
||||
? failure.message
|
||||
: 'accountDevicesLoadFailed';
|
||||
error = failure is ApiException ? failure.message : 'networkError';
|
||||
} finally {
|
||||
loading = false;
|
||||
_notify();
|
||||
|
||||
@@ -25,9 +25,7 @@ class AccountExportLogic extends ChangeNotifier {
|
||||
try {
|
||||
data = await _repository.export();
|
||||
} catch (failure) {
|
||||
error = failure is ApiException
|
||||
? failure.message
|
||||
: 'accountExportLoadFailed';
|
||||
error = failure is ApiException ? failure.message : 'networkError';
|
||||
} finally {
|
||||
loading = false;
|
||||
_notify();
|
||||
|
||||
@@ -30,7 +30,7 @@ class AccountProfileLogic extends ChangeNotifier {
|
||||
try {
|
||||
profile = await _repository.profile();
|
||||
} catch (failure) {
|
||||
error = _message(failure) ?? 'accountProfileLoadFailed';
|
||||
error = _message(failure);
|
||||
} finally {
|
||||
loading = false;
|
||||
_notify();
|
||||
@@ -68,7 +68,7 @@ class AccountProfileLogic extends ChangeNotifier {
|
||||
await onProfileUpdated(next);
|
||||
return true;
|
||||
} catch (failure) {
|
||||
error = _message(failure) ?? 'accountProfileSaveFailed';
|
||||
error = _message(failure);
|
||||
return false;
|
||||
} finally {
|
||||
saving = false;
|
||||
@@ -76,8 +76,8 @@ class AccountProfileLogic extends ChangeNotifier {
|
||||
}
|
||||
}
|
||||
|
||||
String? _message(Object failure) =>
|
||||
failure is ApiException ? failure.message : null;
|
||||
String _message(Object failure) =>
|
||||
failure is ApiException ? failure.message : 'networkError';
|
||||
|
||||
void _notify() {
|
||||
if (!_disposed) notifyListeners();
|
||||
|
||||
Reference in new issue
Block a user