Fix client-side errors
This commit is contained in:
@@ -9,7 +9,6 @@ import {createVuetify} from 'vuetify'
|
|||||||
import * as components from 'vuetify/components'
|
import * as components from 'vuetify/components'
|
||||||
import * as directives from 'vuetify/directives'
|
import * as directives from 'vuetify/directives'
|
||||||
import vueGoogleOauth from 'vue3-google-login'
|
import vueGoogleOauth from 'vue3-google-login'
|
||||||
import {useSubscriptionStore} from "@/stores/subscriptionStore.js";
|
|
||||||
import {useAuthStore} from "@/stores/authStore.js";
|
import {useAuthStore} from "@/stores/authStore.js";
|
||||||
import i18n from './i18n.js';
|
import i18n from './i18n.js';
|
||||||
import {useUserProfileStore} from "@/stores/userProfileStore.js";
|
import {useUserProfileStore} from "@/stores/userProfileStore.js";
|
||||||
@@ -33,7 +32,6 @@ const app = createApp(App)
|
|||||||
app.config.globalProperties.$t = i18n.global.t;
|
app.config.globalProperties.$t = i18n.global.t;
|
||||||
|
|
||||||
// this force the creation and initialization of the stores
|
// this force the creation and initialization of the stores
|
||||||
useSubscriptionStore()
|
|
||||||
useAuthStore()
|
useAuthStore()
|
||||||
useUserProfileStore()
|
useUserProfileStore()
|
||||||
useCreatorProfileStore()
|
useCreatorProfileStore()
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ export const useCreatorProfileStore = defineStore(
|
|||||||
() => authStore.isAuthenticated,
|
() => authStore.isAuthenticated,
|
||||||
async (newValue) => {
|
async (newValue) => {
|
||||||
if (newValue) {
|
if (newValue) {
|
||||||
await fetchCurrentCreatorProfile();
|
value.value = await fetchCurrentCreatorProfile();
|
||||||
if (value.value === undefined) {
|
if (value.value === undefined) {
|
||||||
await router.push('/');
|
await router.push('/');
|
||||||
} else {
|
} else {
|
||||||
@@ -41,9 +41,9 @@ export const useCreatorProfileStore = defineStore(
|
|||||||
async function fetchCurrentCreatorProfile() {
|
async function fetchCurrentCreatorProfile() {
|
||||||
try {
|
try {
|
||||||
const creatorResponse = await client.get(`/api/creators/profile`);
|
const creatorResponse = await client.get(`/api/creators/profile`);
|
||||||
value.value = creatorResponse.data;
|
return creatorResponse.data;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
value.value = undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
class="w-full drop-shadow-[0_10px_6px_rgba(0,0,0,0.25)] h-60"
|
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"
|
alt="Profile Banner"
|
||||||
>
|
>
|
||||||
<!-- Tint Effect -->
|
<!-- Tint Effect -->
|
||||||
|
|||||||
@@ -21,49 +21,56 @@ function GetSocialsUrls() {
|
|||||||
const socials = [];
|
const socials = [];
|
||||||
const brandingSocials = brandingStore.value.socials;
|
const brandingSocials = brandingStore.value.socials;
|
||||||
|
|
||||||
if (brandingSocials.facebookUrl) {
|
if (brandingSocials?.facebookUrl) {
|
||||||
socials.push({
|
socials.push({
|
||||||
icon: 'mdi-facebook',
|
icon: 'mdi-facebook',
|
||||||
url: brandingSocials.facebookUrl,
|
url: brandingSocials.facebookUrl,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (brandingSocials.instagramUrl) {
|
|
||||||
|
if (brandingSocials?.instagramUrl) {
|
||||||
socials.push({
|
socials.push({
|
||||||
icon: 'mdi-instagram',
|
icon: 'mdi-instagram',
|
||||||
url: brandingSocials.instagramUrl,
|
url: brandingSocials.instagramUrl,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (brandingSocials.xUrl) {
|
|
||||||
|
if (brandingSocials?.xUrl) {
|
||||||
socials.push({
|
socials.push({
|
||||||
icon: 'mdi-twitter',
|
icon: 'mdi-twitter',
|
||||||
url: brandingSocials.xUrl,
|
url: brandingSocials.xUrl,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (brandingSocials.linkedInUrl) {
|
|
||||||
|
if (brandingSocials?.linkedInUrl) {
|
||||||
socials.push({
|
socials.push({
|
||||||
icon: 'mdi-linkedin',
|
icon: 'mdi-linkedin',
|
||||||
url: brandingSocials.linkedInUrl,
|
url: brandingSocials.linkedInUrl,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (brandingSocials.tikTokUrl) {
|
|
||||||
|
if (brandingSocials?.tikTokUrl) {
|
||||||
socials.push({
|
socials.push({
|
||||||
icon: '/images/socials/tiktok-white.png',
|
icon: '/images/socials/tiktok-white.png',
|
||||||
url: brandingSocials.tikTokUrl,
|
url: brandingSocials.tikTokUrl,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (brandingSocials.youtubeUrl) {
|
|
||||||
|
if (brandingSocials?.youtubeUrl) {
|
||||||
socials.push({
|
socials.push({
|
||||||
icon: 'mdi-youtube',
|
icon: 'mdi-youtube',
|
||||||
url: brandingSocials.youtubeUrl,
|
url: brandingSocials.youtubeUrl,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (brandingSocials.redditUrl) {
|
|
||||||
|
if (brandingSocials?.redditUrl) {
|
||||||
socials.push({
|
socials.push({
|
||||||
icon: 'mdi-reddit',
|
icon: 'mdi-reddit',
|
||||||
url: brandingSocials.redditUrl,
|
url: brandingSocials.redditUrl,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (brandingSocials.websiteUrl) {
|
|
||||||
|
if (brandingSocials?.websiteUrl) {
|
||||||
socials.push({
|
socials.push({
|
||||||
icon: 'mdi-web',
|
icon: 'mdi-web',
|
||||||
url: brandingSocials.websiteUrl,
|
url: brandingSocials.websiteUrl,
|
||||||
|
|||||||
@@ -27,14 +27,12 @@ async function createAccount() {
|
|||||||
isOperationPending.value = true;
|
isOperationPending.value = true;
|
||||||
const client = useClient();
|
const client = useClient();
|
||||||
errorMessage.value = '';
|
errorMessage.value = '';
|
||||||
const normalizedCreatorName = creatorName.value.toLowerCase();
|
|
||||||
await client.post('/api/creators', {
|
await client.post('/api/creators', {
|
||||||
creatorId: userProfileStore.user.id,
|
creatorId: userProfileStore.user.id,
|
||||||
name: normalizedCreatorName,
|
|
||||||
slugReservationId: creatorNameReservationId.value,
|
slugReservationId: creatorNameReservationId.value,
|
||||||
});
|
});
|
||||||
await creatorProfileStore.fetchCurrentCreatorProfile();
|
await creatorProfileStore.fetchCurrentCreatorProfile();
|
||||||
await router.push(`/@${normalizedCreatorName}`);
|
await router.push(`/@${creatorProfileStore.creator.name}`);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error?.response?.data?.errors) {
|
if (error?.response?.data?.errors) {
|
||||||
errorMessage.value = error.response.data.errors[0]?.['reason'] || 'An unexpected error occurred.';
|
errorMessage.value = error.response.data.errors[0]?.['reason'] || 'An unexpected error occurred.';
|
||||||
|
|||||||
@@ -445,6 +445,8 @@ function updateImage(field, event) {
|
|||||||
|
|
||||||
// Charger les données au montage
|
// Charger les données au montage
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
if (brandingStore.presentationInfos === undefined) return;
|
||||||
|
|
||||||
mainTitle.value = brandingStore.presentationInfos.title;
|
mainTitle.value = brandingStore.presentationInfos.title;
|
||||||
mainImageUrl.value = brandingStore.presentationInfos.mainImageUrl;
|
mainImageUrl.value = brandingStore.presentationInfos.mainImageUrl;
|
||||||
mainImageText.value = brandingStore.presentationInfos.mainImageText;
|
mainImageText.value = brandingStore.presentationInfos.mainImageText;
|
||||||
|
|||||||
@@ -7,9 +7,7 @@
|
|||||||
|
|
||||||
<img
|
<img
|
||||||
class="shadow-2xl rounded-full border-solid border-hSecondary border-102 max-w-[190px]"
|
class="shadow-2xl rounded-full border-solid border-hSecondary border-102 max-w-[190px]"
|
||||||
:src="brandingStore.value.images.logo
|
:src="brandingStore.value.images?.logo ?? '/images/placeholders/logo.png'"
|
||||||
? brandingStore.value.images.logo
|
|
||||||
: '/images/placeholders/logo.png'"
|
|
||||||
alt="Profile Picture"
|
alt="Profile Picture"
|
||||||
:style="{
|
:style="{
|
||||||
height: '190px'
|
height: '190px'
|
||||||
|
|||||||
@@ -18,8 +18,13 @@ export default defineConfig(({mode}) => {
|
|||||||
key: fs.readFileSync('localhost-key.pem'),
|
key: fs.readFileSync('localhost-key.pem'),
|
||||||
cert: fs.readFileSync('localhost.pem'),
|
cert: fs.readFileSync('localhost.pem'),
|
||||||
},
|
},
|
||||||
|
port: 5173, // Ensure this matches your WebStorm debug URL
|
||||||
|
open: true, // Automatically opens the browser
|
||||||
host: 'localhost',
|
host: 'localhost',
|
||||||
},
|
},
|
||||||
|
build: {
|
||||||
|
sourcemap: true // Enable source maps for debugging
|
||||||
|
},
|
||||||
resolve: {
|
resolve: {
|
||||||
alias: {
|
alias: {
|
||||||
'@': fileURLToPath(new URL('./src', import.meta.url))
|
'@': fileURLToPath(new URL('./src', import.meta.url))
|
||||||
|
|||||||
Reference in New Issue
Block a user