Various improvements
This commit is contained in:
@@ -6,6 +6,7 @@ import Button from '../ui/Button';
|
||||
import { Input } from '../ui/Input';
|
||||
import LibrarySwitchLoader from '../ui/LibrarySwitchLoader';
|
||||
import { useLibrarySwitch } from '../../hooks/useLibrarySwitch';
|
||||
import { setCurrentLibraryId, clearLibraryCache } from '../../lib/api';
|
||||
|
||||
interface Library {
|
||||
id: string;
|
||||
@@ -65,6 +66,8 @@ export default function LibrarySettings() {
|
||||
if (response.ok) {
|
||||
const data = await response.json();
|
||||
setCurrentLibrary(data);
|
||||
// Set the library ID for image URL generation
|
||||
setCurrentLibraryId(data.id);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to load current library:', error);
|
||||
@@ -87,6 +90,8 @@ export default function LibrarySettings() {
|
||||
};
|
||||
|
||||
const handleSwitchComplete = () => {
|
||||
// Clear the library cache so images use the new library
|
||||
clearLibraryCache();
|
||||
// Refresh the page to reload with new library context
|
||||
router.refresh();
|
||||
window.location.reload();
|
||||
|
||||
Reference in New Issue
Block a user