This commit is contained in:
Tomáš Dvořák
2025-10-16 17:10:13 +02:00
parent f5e7be92c7
commit 35d0954afd
84 changed files with 9571 additions and 4668 deletions
+10 -17
View File
@@ -25,7 +25,8 @@ import {
useColorModeValue,
} from '@chakra-ui/react';
import { RefreshCw, ExternalLink, Calendar, Image as ImageIcon, Eye } from 'lucide-react';
import AdminLayout from '../../components/layout/AdminLayout';
import AdminLayout from '../../layouts/AdminLayout';
import api from '../../services/api';
interface Album {
id: string;
@@ -114,20 +115,8 @@ const GalleryAdminPage: React.FC = () => {
setRefreshing(true);
try {
const apiUrl = process.env.REACT_APP_API_URL || 'http://localhost:8080/api/v1';
const token = localStorage.getItem('token');
const response = await fetch(`${apiUrl}/admin/gallery/refresh`, {
method: 'POST',
headers: {
'Authorization': `Bearer ${token}`,
'Content-Type': 'application/json',
},
});
if (!response.ok) {
throw new Error('Chyba při obnově galerie');
}
// Use the api service which automatically includes authentication
await api.post('/admin/gallery/refresh');
toast({
title: 'Galerie obnovena',
@@ -140,13 +129,17 @@ const GalleryAdminPage: React.FC = () => {
// Reload albums after refresh
await fetchAlbums();
} catch (err: any) {
const errorMessage = err.response?.data?.error || err.message || 'Nepodařilo se obnovit galerii';
toast({
title: 'Chyba',
description: err.message || 'Nepodařilo se obnovit galerii',
title: 'Chyba při obnově galerie',
description: errorMessage,
status: 'error',
duration: 5000,
isClosable: true,
});
console.error('Gallery refresh error:', err);
} finally {
setRefreshing(false);
}