Fix image loading

This commit is contained in:
Stefan Hardegger
2026-05-01 17:16:27 +02:00
parent 5780493623
commit f4ffe67505
2 changed files with 31 additions and 2 deletions

View File

@@ -38,7 +38,10 @@ export function AuthProvider({ children }: { children: React.ReactNode }) {
// If authenticated, also load current library for image URLs
if (authenticated) {
try {
const response = await fetch('/api/libraries/current');
const token = localStorage.getItem('auth-token');
const response = await fetch('/api/libraries/current', {
headers: token ? { 'Authorization': `Bearer ${token}` } : {}
});
if (response.ok) {
const library = await response.json();
setCurrentLibraryId(library.id);
@@ -75,7 +78,10 @@ export function AuthProvider({ children }: { children: React.ReactNode }) {
// Load current library after successful login
try {
const response = await fetch('/api/libraries/current');
const token = localStorage.getItem('auth-token');
const response = await fetch('/api/libraries/current', {
headers: token ? { 'Authorization': `Bearer ${token}` } : {}
});
if (response.ok) {
const library = await response.json();
setCurrentLibraryId(library.id);