Integrate React frontend with backend API

This commit is contained in:
Koha9
2025-11-28 03:00:02 +09:00
parent 4c6af7115e
commit 8d358a1de2
14 changed files with 2608 additions and 150 deletions
@@ -47,10 +47,10 @@ const ConnectionModal: React.FC<ConnectionModalProps> = ({ isOpen, onClose, onCo
setFormData(prev => ({ ...prev, [name]: value }));
};
const handleLibraryChange = (e: React.ChangeEvent<HTMLSelectElement>) => {
const handleLibraryChange = async (e: React.ChangeEvent<HTMLSelectElement>) => {
const newId = e.target.value;
setSelectedLibraryId(newId);
const lib = libraries.find(l => l.id === newId);
if (lib && connectedServerInfo) {
const updatedInfo = { ...connectedServerInfo, libraryName: lib.title };
@@ -59,6 +59,7 @@ const ConnectionModal: React.FC<ConnectionModalProps> = ({ isOpen, onClose, onCo
onConnectSuccess(updatedInfo);
// Show toast
onShowMessage(`Library switched to ${lib.title}`);
await apiService.selectLibrary(lib.title);
}
};
@@ -100,6 +101,7 @@ const ConnectionModal: React.FC<ConnectionModalProps> = ({ isOpen, onClose, onCo
const defaultLib = libs[0];
setSelectedLibraryId(defaultLib.id);
// Pass connection info back with default library name explicitly set (though mock already does it)
await apiService.selectLibrary(defaultLib.title);
onConnectSuccess({
...info,
libraryName: defaultLib.title