修复用户端令牌失效后的登录恢复
This commit is contained in:
@@ -8,6 +8,7 @@ import 'package:uuid/uuid.dart';
|
||||
|
||||
import '../../../app/dependencies.dart';
|
||||
import '../../../data/repositories/client_repository.dart';
|
||||
import '../../../data/services/api_client.dart';
|
||||
import '../../../domain/models/client_models.dart';
|
||||
import '../../core/widgets.dart';
|
||||
import 'profile_avatar.dart';
|
||||
@@ -65,7 +66,11 @@ class _ProfilePageState extends State<ProfilePage> {
|
||||
);
|
||||
controller.dispose();
|
||||
if (address == null || address.isEmpty) return;
|
||||
await widget.repository.addAddress(address, isDefault: true);
|
||||
try {
|
||||
await widget.repository.addAddress(address, isDefault: true);
|
||||
} on SessionExpiredException {
|
||||
return;
|
||||
}
|
||||
if (mounted) ScaffoldMessenger.of(context).showSnackBar(const SnackBar(content: Text('地址已保存')));
|
||||
}
|
||||
|
||||
@@ -91,11 +96,15 @@ class _ProfilePageState extends State<ProfilePage> {
|
||||
);
|
||||
controller.dispose();
|
||||
if (description == null || description.isEmpty) return;
|
||||
await widget.repository.createTicket(
|
||||
requestNo: const Uuid().v7(),
|
||||
category: 'repair',
|
||||
description: description,
|
||||
);
|
||||
try {
|
||||
await widget.repository.createTicket(
|
||||
requestNo: const Uuid().v7(),
|
||||
category: 'repair',
|
||||
description: description,
|
||||
);
|
||||
} on SessionExpiredException {
|
||||
return;
|
||||
}
|
||||
if (mounted) ScaffoldMessenger.of(context).showSnackBar(const SnackBar(content: Text('工单已提交')));
|
||||
}
|
||||
|
||||
@@ -107,6 +116,9 @@ class _ProfilePageState extends State<ProfilePage> {
|
||||
builder: (context, snapshot) {
|
||||
if (!snapshot.hasData) {
|
||||
if (snapshot.hasError) {
|
||||
if (snapshot.error is SessionExpiredException) {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
return EmptyState(
|
||||
title: '个人信息加载失败',
|
||||
description: '请检查网络后重新进入本页',
|
||||
|
||||
Reference in New Issue
Block a user