diff --git a/frontend/src/stores/creatorProfileStore.js b/frontend/src/stores/creatorProfileStore.js index d11d78a..0adc6ec 100644 --- a/frontend/src/stores/creatorProfileStore.js +++ b/frontend/src/stores/creatorProfileStore.js @@ -8,13 +8,15 @@ import {useRouter} from 'vue-router'; export const useCreatorProfileStore = defineStore( 'creator-profile', () => { + const router = useRouter(); const authStore = useAuthStore(); + watch( () => authStore.isAuthenticated, async (newValue) => { if (newValue) { - await fetchCurrentCreatorProfile(); + await fetchCreatorProfile(); if (value.value === undefined) { await router.push('/'); } else { @@ -45,7 +47,7 @@ export const useCreatorProfileStore = defineStore( const client = useClient(); - async function fetchCurrentCreatorProfile() { + async function fetchCreatorProfile() { try { const response = await client.get(`/api/creators/profile`); value.value = response.data; @@ -57,6 +59,6 @@ export const useCreatorProfileStore = defineStore( return { creator: value, hasCreator, - fetchCurrentCreatorProfile + fetchCreatorProfile }; }); diff --git a/frontend/src/views/creators/BannerActions.vue b/frontend/src/views/creators/BannerActions.vue index 6f93a49..62c99de 100644 --- a/frontend/src/views/creators/BannerActions.vue +++ b/frontend/src/views/creators/BannerActions.vue @@ -2,7 +2,7 @@ import {useClient} from '@/plugins/api.js'; import {useBrandingStore} from '@/stores/brandingStore.js'; import DonationButtonBanner from '@/views/creators/DonationButtonBanner.vue'; -import {onBeforeUnmount, onMounted, ref} from 'vue'; +import {onMounted, ref} from 'vue'; import CreatorLogo from "@/views/creators/CreatorLogo.vue"; import NameTitle from "@/views/creators/NameTitle.vue"; import Linkedin from "@/views/svg/Linkedin.vue"; @@ -15,35 +15,12 @@ import Youtube from "@/views/svg/Youtube.vue"; import Web from "@/views/svg/Web.vue"; const brandingStore = useBrandingStore(); -const isMobile = ref(false); const creator = ref(null); const baseURL = window.location.origin; const creatorName = window.location.pathname.split('/@').pop(); -function updateIsMobile() { - isMobile.value = window.innerWidth <= 640; -} - -const isSticky = ref(false); -const mainContainer = ref(null); - onMounted(async () => { - updateIsMobile(); - window.addEventListener('resize', updateIsMobile); - - const observer = new IntersectionObserver( - ([entry]) => { - isSticky.value = !entry.isIntersecting; - }, - {threshold: 0} - ); - - if (mainContainer.value) { - observer.observe(mainContainer.value); - } - const client = useClient(); - try { const creatorResponse = await client.get(`/api/creators/@${creatorName}`); creator.value = creatorResponse.data; @@ -52,9 +29,6 @@ onMounted(async () => { } }); -onBeforeUnmount(() => { - window.removeEventListener('resize', updateIsMobile); -});