From 73f59e5d040f675e6f2e11f584eef0040bb041e5 Mon Sep 17 00:00:00 2001 From: DarkPhoenix2704 Date: Thu, 28 Nov 2024 14:48:00 +0000 Subject: [PATCH] feat: restore snapshots --- packages/nc-gui/components/dlg/Snapshot/Restore.vue | 13 ++++++++++++- packages/nc-gui/composables/useBaseSettings.ts | 11 +++++++---- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/packages/nc-gui/components/dlg/Snapshot/Restore.vue b/packages/nc-gui/components/dlg/Snapshot/Restore.vue index b74bfade72..e9edd5acba 100644 --- a/packages/nc-gui/components/dlg/Snapshot/Restore.vue +++ b/packages/nc-gui/components/dlg/Snapshot/Restore.vue @@ -17,7 +17,18 @@ const { snapshot } = props const vModel = useVModel(props, 'modelValue', emits) -const { restoreSnapshot, isRestoringSnapshot } = useBaseSettings() +const { restoreSnapshot: _restoreSnapshot, isRestoringSnapshot } = useBaseSettings() + +const restoreSnapshot = async (snapshot: SnapshotExtendedType) => { + try { + await _restoreSnapshot(snapshot, () => { + vModel.value = false + emits('update:modelValue', false) + }) + } catch (error) { + console.error(error) + } +}