bug: missing images when not authenticated
This commit is contained in:
@@ -43,6 +43,7 @@ public class GetAlbumHandler(
|
||||
{
|
||||
public override void Configure()
|
||||
{
|
||||
AllowAnonymous();
|
||||
Get("/api/albums/{AlbumId}");
|
||||
Options(o => o.WithTags("Albums"));
|
||||
}
|
||||
@@ -51,13 +52,11 @@ public class GetAlbumHandler(
|
||||
GetAlbumRequest request,
|
||||
CancellationToken ct)
|
||||
{
|
||||
var userId = User.GetUserId();
|
||||
|
||||
var album = await context
|
||||
.Albums
|
||||
.Include(a => a.Photos.OrderBy(p => p.Order))
|
||||
.SingleOrDefaultAsync(
|
||||
a => a.Id == request.AlbumId && a.CreatedBy == userId,
|
||||
a => a.Id == request.AlbumId,
|
||||
cancellationToken: ct);
|
||||
|
||||
if (album is null)
|
||||
|
||||
@@ -22,10 +22,8 @@ export const useBrandingStore = defineStore(
|
||||
watch(
|
||||
() => route.params.creator,
|
||||
async (creator) => {
|
||||
console.log(`creator: ${creator}`)
|
||||
// Extract just the creator name from the path (remove any additional segments)
|
||||
const creatorName = creator ? creator.split('/')[0] : undefined;
|
||||
console.log(`name: ${creatorName}`)
|
||||
await updateBrand(creatorName);
|
||||
}
|
||||
)
|
||||
|
||||
@@ -201,9 +201,9 @@ function toggleEditMode() {
|
||||
|
||||
// Fetch album data
|
||||
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 to get the album
|
||||
@@ -247,7 +247,7 @@ function updateImages(newImages) {
|
||||
}
|
||||
|
||||
async function saveChanges() {
|
||||
if (!creatorProfileStore.creator.id) {
|
||||
if (!brandingStore.value?.id) {
|
||||
console.error("L'ID du créateur est manquant !");
|
||||
return;
|
||||
}
|
||||
@@ -262,7 +262,7 @@ async function saveChanges() {
|
||||
|
||||
// Save presentation info
|
||||
const presentationResponse = await client.post(
|
||||
`/api/creators/${creatorProfileStore.creator.id}/presentation-infos`,
|
||||
`/api/creators/${brandingStore.value.id}/presentation-infos`,
|
||||
{
|
||||
description: editableDescription.value || "",
|
||||
videoUrl: editableVideoUrl.value || "",
|
||||
@@ -280,13 +280,13 @@ async function saveChanges() {
|
||||
// Save album photos if they've changed
|
||||
if (imageUrls.value.length > 0) {
|
||||
// Create or update the album
|
||||
const albumId = creatorProfileStore.creator.id;
|
||||
const albumId = brandingStore.value.id;
|
||||
|
||||
try {
|
||||
// Try to create the album first (it will fail if it already exists)
|
||||
await client.post('/api/albums', {
|
||||
albumId: albumId,
|
||||
title: `${creatorProfileStore.creator.name}'s Album`,
|
||||
title: `${brandingStore.value.name}'s Album`,
|
||||
description: "Photo album for the creator"
|
||||
});
|
||||
} catch (error) {
|
||||
|
||||
@@ -11,7 +11,6 @@ const creatorName = window.location.pathname.split('/@')[1]?.split('/')[0] || ''
|
||||
const { t } = useI18n();
|
||||
|
||||
onMounted(async () => {
|
||||
console.log(`creatorName: ${creatorName}`)
|
||||
await brandingStore.updateBrand(creatorName);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user