mirror of
https://github.com/shuaiplus/nodewarden.git
synced 2026-06-20 21:00:41 +00:00
feat: add restore functionality for deleted items with corresponding UI updates
This commit is contained in:
@@ -932,6 +932,11 @@ export function createDemoMainRoutesProps(base: AppMainRoutesProps, notify: Noti
|
||||
notify('success', t('txt_item_updated'));
|
||||
},
|
||||
onDeleteVaultItem: async (cipher) => {
|
||||
if (cipher.deletedDate || (cipher as { deletedAt?: string | null }).deletedAt) {
|
||||
state.setCiphers((prev) => prev.filter((item) => item.id !== cipher.id));
|
||||
notify('success', t('txt_item_deleted_permanently'));
|
||||
return;
|
||||
}
|
||||
const deletedDate = new Date().toISOString();
|
||||
state.setCiphers((prev) => prev.map((item) => (
|
||||
item.id === cipher.id ? { ...item, deletedDate, archivedDate: null, revisionDate: deletedDate } : item
|
||||
@@ -965,6 +970,11 @@ export function createDemoMainRoutesProps(base: AppMainRoutesProps, notify: Noti
|
||||
state.setCiphers((prev) => prev.filter((item) => !idSet.has(item.id)));
|
||||
notify('success', t('txt_deleted_selected_items_permanently'));
|
||||
},
|
||||
onRestoreVaultItems: async (ids) => {
|
||||
const idSet = new Set(ids);
|
||||
state.setCiphers((prev) => prev.map((item) => (idSet.has(item.id) ? { ...item, deletedDate: null } : item)));
|
||||
notify('success', t('txt_restored_selected_items'));
|
||||
},
|
||||
onBulkRestoreVaultItems: async (ids) => {
|
||||
const idSet = new Set(ids);
|
||||
state.setCiphers((prev) => prev.map((item) => (idSet.has(item.id) ? { ...item, deletedDate: null } : item)));
|
||||
|
||||
Reference in New Issue
Block a user