Fix library path saving - auto-create directory and improve error handling
This commit is contained in:
@@ -311,7 +311,7 @@ async function loadSettings() {
|
||||
|
||||
// Save library path
|
||||
async function saveLibraryPath() {
|
||||
const libraryPath = document.getElementById('libraryPath').value;
|
||||
const libraryPath = document.getElementById('libraryPath').value.trim();
|
||||
|
||||
if (!libraryPath) {
|
||||
alert('Please enter a library path');
|
||||
@@ -328,13 +328,14 @@ async function saveLibraryPath() {
|
||||
const data = await res.json();
|
||||
|
||||
if (res.ok) {
|
||||
alert('Library path updated! Please restart the server for changes to take effect.');
|
||||
alert('✅ Library path saved!\n\nPath: ' + libraryPath + '\n\nPlease restart the server for changes to take effect.');
|
||||
} else {
|
||||
alert(`Error: ${data.error}`);
|
||||
alert('❌ Error: ' + (data.error || 'Failed to save'));
|
||||
console.error('Server error:', data);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error saving settings:', error);
|
||||
alert('Failed to save settings');
|
||||
alert('❌ Failed to save settings. Check console for details.\n\nError: ' + error.message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user