From 21b329f8368144b2cfa1475e6660f0f31a555638 Mon Sep 17 00:00:00 2001 From: Benjent Date: Tue, 30 Apr 2024 12:50:49 +0200 Subject: [PATCH] feat: reset stores (#62) --- components/TheHeader.vue | 25 +++++++++++++++++++++---- stores/letter.ts | 23 ++++++++--------------- stores/profile.ts | 28 +++++++++------------------- stores/resume.ts | 23 ++++++++--------------- 4 files changed, 46 insertions(+), 53 deletions(-) diff --git a/components/TheHeader.vue b/components/TheHeader.vue index 9de4e5c..766813d 100644 --- a/components/TheHeader.vue +++ b/components/TheHeader.vue @@ -2,8 +2,9 @@ import { ref } from "vue"; import { storeToRefs } from "pinia"; import { - ArrowUpOnSquareIcon, ArrowDownOnSquareIcon, + ArrowUpOnSquareIcon, + ArrowPathIcon, } from "@heroicons/vue/24/outline"; import { useEditorStore } from "@/stores/editor"; import { useLetterStore } from "@/stores/letter"; @@ -20,9 +21,12 @@ const { documentType, zoomLevel } = storeToRefs(useEditorStore()); const { template } = storeToRefs(useProfileStore()); -const profile = storeToRefs(useProfileStore()); -const letter = storeToRefs(useLetterStore()); -const resume = storeToRefs(useResumeStore()); +const profileStore = useProfileStore(); +const profile = storeToRefs(profileStore); +const letterStore = useLetterStore(); +const letter = storeToRefs(letterStore); +const resumeStore = useResumeStore(); +const resume = storeToRefs(resumeStore); const isImportError = ref(false); @@ -93,6 +97,12 @@ function importFromJson(event: Event) { isImportError.value = true; } } + +function resetStores() { + profileStore.$reset(); + letterStore.$reset(); + resumeStore.$reset(); +}