Fix image loading
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user