fix: support offline manual bookkeeping
This commit is contained in:
@@ -65,7 +65,13 @@ class _CategoryManagePageState extends State<CategoryManagePage> {
|
||||
final result = await _showEditor();
|
||||
if (result == null) return;
|
||||
try {
|
||||
await CategoryApi.create(result.name, result.icon, result.color, _type);
|
||||
await CategoryApi.create(
|
||||
result.name,
|
||||
result.icon,
|
||||
result.color,
|
||||
_type,
|
||||
localFirst: true,
|
||||
);
|
||||
await _load();
|
||||
} catch (error) {
|
||||
if (mounted) _showError(error);
|
||||
@@ -82,6 +88,7 @@ class _CategoryManagePageState extends State<CategoryManagePage> {
|
||||
iconKey: result.icon,
|
||||
colorKey: result.color,
|
||||
sortOrder: category.sortOrder,
|
||||
localFirst: true,
|
||||
);
|
||||
await _load();
|
||||
} catch (error) {
|
||||
@@ -375,7 +382,7 @@ class _CategoryManagePageState extends State<CategoryManagePage> {
|
||||
);
|
||||
if (!confirmed) return;
|
||||
try {
|
||||
await CategoryApi.delete(category.id);
|
||||
await CategoryApi.delete(category.id, localFirst: true);
|
||||
await _load();
|
||||
} catch (error) {
|
||||
if (mounted) _showError(error);
|
||||
@@ -410,7 +417,7 @@ class _CategoryManagePageState extends State<CategoryManagePage> {
|
||||
final ids = _custom.map((category) => category.id).toList();
|
||||
setState(() => _savingOrder = true);
|
||||
try {
|
||||
await CategoryApi.reorder(_type, ids);
|
||||
await CategoryApi.reorder(_type, ids, localFirst: true);
|
||||
if (!mounted) return;
|
||||
setState(() {
|
||||
_reordering = false;
|
||||
|
||||
Reference in New Issue
Block a user