From 1007b03737a07e63b1cad99a746b8474df6f620e Mon Sep 17 00:00:00 2001 From: Andre Abelmann <3215327+aabelmann@users.noreply.github.com> Date: Thu, 31 Oct 2024 09:38:51 +0100 Subject: [PATCH] Fix: When Saving flix revert back to draft --- .gitignore | 1 + nuxt/stores/flix.ts | 12 +++++------- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 8a48200..bb69af2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ # Root .gitignore +.env # Node.js node_modules/ diff --git a/nuxt/stores/flix.ts b/nuxt/stores/flix.ts index db13fb1..217be27 100644 --- a/nuxt/stores/flix.ts +++ b/nuxt/stores/flix.ts @@ -5,7 +5,7 @@ export const useFlixStore = defineStore('flix', () => { const currentFlix = ref(); const currentToken = ref(); const currentViewport = ref('laptop'); - const isPreview = ref(false); + const isPreview = ref(true); /** * Computed Properties @@ -39,7 +39,7 @@ export const useFlixStore = defineStore('flix', () => { // Reset the values back to default currentFlix.value = undefined; currentToken.value = undefined; - isPreview.value = false; + isPreview.value = true; currentViewport.value = 'laptop'; // Also clean up other stores @@ -106,15 +106,13 @@ export const useFlixStore = defineStore('flix', () => { } // Check if we are publishing - if (publish) { - currentFlix.value.publishedAt = useStrapiDate(); - currentFlix.value.status = 'published'; - } + currentFlix.value.publishedAt = publish ? useStrapiDate() : null; + currentFlix.value.status = publish ? 'published' : 'draft'; + isPreview.value = !publish; // Save the flix const response = await useSaveFlix(currentFlix.value); if (response?.flix) { - isPreview.value = !!publish; currentFlix.value = response.flix; currentToken.value = response.hash; return response.hash;