Fix client-side errors

This commit is contained in:
2025-02-10 13:24:14 -05:00
parent 69f2759af5
commit 852ea63672
8 changed files with 28 additions and 20 deletions

View File

@@ -9,7 +9,6 @@ import {createVuetify} from 'vuetify'
import * as components from 'vuetify/components'
import * as directives from 'vuetify/directives'
import vueGoogleOauth from 'vue3-google-login'
import {useSubscriptionStore} from "@/stores/subscriptionStore.js";
import {useAuthStore} from "@/stores/authStore.js";
import i18n from './i18n.js';
import {useUserProfileStore} from "@/stores/userProfileStore.js";
@@ -33,7 +32,6 @@ const app = createApp(App)
app.config.globalProperties.$t = i18n.global.t;
// this force the creation and initialization of the stores
useSubscriptionStore()
useAuthStore()
useUserProfileStore()
useCreatorProfileStore()

View File

@@ -14,7 +14,7 @@ export const useCreatorProfileStore = defineStore(
() => authStore.isAuthenticated,
async (newValue) => {
if (newValue) {
await fetchCurrentCreatorProfile();
value.value = await fetchCurrentCreatorProfile();
if (value.value === undefined) {
await router.push('/');
} else {
@@ -41,9 +41,9 @@ export const useCreatorProfileStore = defineStore(
async function fetchCurrentCreatorProfile() {
try {
const creatorResponse = await client.get(`/api/creators/profile`);
value.value = creatorResponse.data;
return creatorResponse.data;
} catch (error) {
value.value = undefined;
return undefined;
}
}

View File

@@ -10,7 +10,7 @@
>
<img
class="w-full drop-shadow-[0_10px_6px_rgba(0,0,0,0.25)] h-60"
:src="brandingStore.value.images.banner ? brandingStore.value.images.banner : '/images/placeholders/banner.png'"
:src="brandingStore.value.images?.banner ?? '/images/placeholders/banner.png'"
alt="Profile Banner"
>
<!-- Tint Effect -->

View File

@@ -21,49 +21,56 @@ function GetSocialsUrls() {
const socials = [];
const brandingSocials = brandingStore.value.socials;
if (brandingSocials.facebookUrl) {
if (brandingSocials?.facebookUrl) {
socials.push({
icon: 'mdi-facebook',
url: brandingSocials.facebookUrl,
});
}
if (brandingSocials.instagramUrl) {
if (brandingSocials?.instagramUrl) {
socials.push({
icon: 'mdi-instagram',
url: brandingSocials.instagramUrl,
});
}
if (brandingSocials.xUrl) {
if (brandingSocials?.xUrl) {
socials.push({
icon: 'mdi-twitter',
url: brandingSocials.xUrl,
});
}
if (brandingSocials.linkedInUrl) {
if (brandingSocials?.linkedInUrl) {
socials.push({
icon: 'mdi-linkedin',
url: brandingSocials.linkedInUrl,
});
}
if (brandingSocials.tikTokUrl) {
if (brandingSocials?.tikTokUrl) {
socials.push({
icon: '/images/socials/tiktok-white.png',
url: brandingSocials.tikTokUrl,
});
}
if (brandingSocials.youtubeUrl) {
if (brandingSocials?.youtubeUrl) {
socials.push({
icon: 'mdi-youtube',
url: brandingSocials.youtubeUrl,
});
}
if (brandingSocials.redditUrl) {
if (brandingSocials?.redditUrl) {
socials.push({
icon: 'mdi-reddit',
url: brandingSocials.redditUrl,
});
}
if (brandingSocials.websiteUrl) {
if (brandingSocials?.websiteUrl) {
socials.push({
icon: 'mdi-web',
url: brandingSocials.websiteUrl,

View File

@@ -27,14 +27,12 @@ async function createAccount() {
isOperationPending.value = true;
const client = useClient();
errorMessage.value = '';
const normalizedCreatorName = creatorName.value.toLowerCase();
await client.post('/api/creators', {
creatorId: userProfileStore.user.id,
name: normalizedCreatorName,
slugReservationId: creatorNameReservationId.value,
});
await creatorProfileStore.fetchCurrentCreatorProfile();
await router.push(`/@${normalizedCreatorName}`);
await router.push(`/@${creatorProfileStore.creator.name}`);
} catch (error) {
if (error?.response?.data?.errors) {
errorMessage.value = error.response.data.errors[0]?.['reason'] || 'An unexpected error occurred.';

View File

@@ -445,6 +445,8 @@ function updateImage(field, event) {
// Charger les données au montage
onMounted(() => {
if (brandingStore.presentationInfos === undefined) return;
mainTitle.value = brandingStore.presentationInfos.title;
mainImageUrl.value = brandingStore.presentationInfos.mainImageUrl;
mainImageText.value = brandingStore.presentationInfos.mainImageText;

View File

@@ -7,9 +7,7 @@
<img
class="shadow-2xl rounded-full border-solid border-hSecondary border-102 max-w-[190px]"
:src="brandingStore.value.images.logo
? brandingStore.value.images.logo
: '/images/placeholders/logo.png'"
:src="brandingStore.value.images?.logo ?? '/images/placeholders/logo.png'"
alt="Profile Picture"
:style="{
height: '190px'

View File

@@ -18,8 +18,13 @@ export default defineConfig(({mode}) => {
key: fs.readFileSync('localhost-key.pem'),
cert: fs.readFileSync('localhost.pem'),
},
port: 5173, // Ensure this matches your WebStorm debug URL
open: true, // Automatically opens the browser
host: 'localhost',
},
build: {
sourcemap: true // Enable source maps for debugging
},
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))