Some cleanup

This commit is contained in:
2025-02-13 15:14:32 -05:00
parent 9c716b1520
commit bf5ba51c9f
4 changed files with 8 additions and 37 deletions

View File

@@ -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);
});
</script>
<template>

View File

@@ -22,6 +22,7 @@ function handleCreatorNameReservationIdChanged($event) {
creatorNameReservationId.value = $event.value
}
// TODO: The `fetchCreatorProfile` function should be private (push-up to the store)!
async function createAccount() {
try {
isOperationPending.value = true;
@@ -31,7 +32,7 @@ async function createAccount() {
creatorId: userProfileStore.user.id,
slugReservationId: creatorNameReservationId.value,
});
await creatorProfileStore.fetchCurrentCreatorProfile();
await creatorProfileStore.fetchCreatorProfile();
await router.push(`/@${creatorProfileStore.creator.name}`);
} catch (error) {
if (error?.response?.data?.errors) {

View File

@@ -290,9 +290,6 @@ import {onMounted, ref} from "vue";
import {useClient} from "@/plugins/api.js";
import {useBrandingStore} from "@/stores/brandingStore.js";
import {useCreatorProfileStore} from "@/stores/creatorProfileStore.js";
import {useDisplay} from "vuetify";
const {smAndDown} = useDisplay();
const creatorProfileStore = useCreatorProfileStore();
const brandingStore = useBrandingStore();
@@ -302,9 +299,6 @@ const isLoading = ref(true);
const isLoggedIn = true;
const isEditMode = ref(false);
const currentImage = ref("");
const fullscreenImage = ref(null);
const fallbackImage = "/medias/emptyimage.png";
// Variables réactives pour les données