From 0d383c35b53a008bd8643ea08083a42537adf979 Mon Sep 17 00:00:00 2001 From: DebaucheryLibrarian Date: Fri, 23 Aug 2024 01:35:39 +0200 Subject: [PATCH] Fixed heart menu stash creation. --- components/stashes/heart.vue | 16 ++++++++++------ components/stashes/menu.vue | 1 + src/stashes.js | 4 ++-- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/components/stashes/heart.vue b/components/stashes/heart.vue index 656c76e..62f9686 100644 --- a/components/stashes/heart.vue +++ b/components/stashes/heart.vue @@ -82,7 +82,8 @@ @@ -114,9 +115,10 @@ const props = defineProps({ const emit = defineEmits(['stashed', 'unstashed']); -const { user, pageProps } = inject('pageContext'); -const pageStash = pageProps.stash; +const pageContext = inject('pageContext'); +const pageStash = pageContext.pageProps.stash; +const user = ref(pageContext.user); const itemStashes = ref(props.item.stashes); const hasSecondaryStash = computed(() => itemStashes.value.some((itemStash) => !itemStash.isPrimary)); @@ -192,10 +194,12 @@ function toggleShowStashes(state) { showStashes.value = !showStashes.value; } -async function reloadStashes() { - const profile = await get(`/users/${user.id}`); +async function reloadStashes(newStash) { + const profile = await get(`/users/${user.value.id}`); - console.log(profile); + user.value = profile; + + await stashItem(newStash); } diff --git a/components/stashes/menu.vue b/components/stashes/menu.vue index f375e18..b65d098 100644 --- a/components/stashes/menu.vue +++ b/components/stashes/menu.vue @@ -15,6 +15,7 @@