bug: missing images when not authenticated

This commit is contained in:
2025-04-24 21:33:28 -04:00
parent d0876861dc
commit c7353626a1
4 changed files with 8 additions and 12 deletions

View File

@@ -43,6 +43,7 @@ public class GetAlbumHandler(
{ {
public override void Configure() public override void Configure()
{ {
AllowAnonymous();
Get("/api/albums/{AlbumId}"); Get("/api/albums/{AlbumId}");
Options(o => o.WithTags("Albums")); Options(o => o.WithTags("Albums"));
} }
@@ -51,13 +52,11 @@ public class GetAlbumHandler(
GetAlbumRequest request, GetAlbumRequest request,
CancellationToken ct) CancellationToken ct)
{ {
var userId = User.GetUserId();
var album = await context var album = await context
.Albums .Albums
.Include(a => a.Photos.OrderBy(p => p.Order)) .Include(a => a.Photos.OrderBy(p => p.Order))
.SingleOrDefaultAsync( .SingleOrDefaultAsync(
a => a.Id == request.AlbumId && a.CreatedBy == userId, a => a.Id == request.AlbumId,
cancellationToken: ct); cancellationToken: ct);
if (album is null) if (album is null)

View File

@@ -22,10 +22,8 @@ export const useBrandingStore = defineStore(
watch( watch(
() => route.params.creator, () => route.params.creator,
async (creator) => { async (creator) => {
console.log(`creator: ${creator}`)
// Extract just the creator name from the path (remove any additional segments) // Extract just the creator name from the path (remove any additional segments)
const creatorName = creator ? creator.split('/')[0] : undefined; const creatorName = creator ? creator.split('/')[0] : undefined;
console.log(`name: ${creatorName}`)
await updateBrand(creatorName); await updateBrand(creatorName);
} }
) )

View File

@@ -201,9 +201,9 @@ function toggleEditMode() {
// Fetch album data // Fetch album data
async function fetchAlbumData() { async function fetchAlbumData() {
if (!creatorProfileStore.creator?.id) return; if (!brandingStore.value?.id) return;
albumId.value = creatorProfileStore.creator.id; albumId.value = brandingStore.value.id;
try { try {
// Try to get the album // Try to get the album
@@ -247,7 +247,7 @@ function updateImages(newImages) {
} }
async function saveChanges() { async function saveChanges() {
if (!creatorProfileStore.creator.id) { if (!brandingStore.value?.id) {
console.error("L'ID du créateur est manquant !"); console.error("L'ID du créateur est manquant !");
return; return;
} }
@@ -262,7 +262,7 @@ async function saveChanges() {
// Save presentation info // Save presentation info
const presentationResponse = await client.post( const presentationResponse = await client.post(
`/api/creators/${creatorProfileStore.creator.id}/presentation-infos`, `/api/creators/${brandingStore.value.id}/presentation-infos`,
{ {
description: editableDescription.value || "", description: editableDescription.value || "",
videoUrl: editableVideoUrl.value || "", videoUrl: editableVideoUrl.value || "",
@@ -280,13 +280,13 @@ async function saveChanges() {
// Save album photos if they've changed // Save album photos if they've changed
if (imageUrls.value.length > 0) { if (imageUrls.value.length > 0) {
// Create or update the album // Create or update the album
const albumId = creatorProfileStore.creator.id; const albumId = brandingStore.value.id;
try { try {
// Try to create the album first (it will fail if it already exists) // Try to create the album first (it will fail if it already exists)
await client.post('/api/albums', { await client.post('/api/albums', {
albumId: albumId, albumId: albumId,
title: `${creatorProfileStore.creator.name}'s Album`, title: `${brandingStore.value.name}'s Album`,
description: "Photo album for the creator" description: "Photo album for the creator"
}); });
} catch (error) { } catch (error) {

View File

@@ -11,7 +11,6 @@ const creatorName = window.location.pathname.split('/@')[1]?.split('/')[0] || ''
const { t } = useI18n(); const { t } = useI18n();
onMounted(async () => { onMounted(async () => {
console.log(`creatorName: ${creatorName}`)
await brandingStore.updateBrand(creatorName); await brandingStore.updateBrand(creatorName);
}); });