gradient-test #4
@ -224,12 +224,6 @@ class DNScopeApp {
|
||||
if (e.target === this.elements.settingsModal) this.hideSettingsModal();
|
||||
});
|
||||
}
|
||||
if (this.elements.saveApiKeys) {
|
||||
this.elements.saveApiKeys.removeEventListener('click', this.saveApiKeys);
|
||||
}
|
||||
if (this.elements.resetApiKeys) {
|
||||
this.elements.resetApiKeys.removeEventListener('click', this.resetApiKeys);
|
||||
}
|
||||
|
||||
// Setup new handlers
|
||||
const saveSettingsBtn = document.getElementById('save-settings');
|
||||
@ -2343,51 +2337,6 @@ class DNScopeApp {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Save API Keys
|
||||
*/
|
||||
async saveApiKeys() {
|
||||
const inputs = this.elements.apiKeyInputs.querySelectorAll('input');
|
||||
const keys = {};
|
||||
inputs.forEach(input => {
|
||||
const provider = input.dataset.provider;
|
||||
const value = input.value.trim();
|
||||
if (provider && value) {
|
||||
keys[provider] = value;
|
||||
}
|
||||
});
|
||||
|
||||
if (Object.keys(keys).length === 0) {
|
||||
this.showWarning('No API keys were entered.');
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const response = await this.apiCall('/api/config/api-keys', 'POST', keys);
|
||||
if (response.success) {
|
||||
this.showSuccess(response.message);
|
||||
this.hideSettingsModal();
|
||||
this.loadProviders(); // Refresh provider status
|
||||
} else {
|
||||
throw new Error(response.error || 'Failed to save API keys');
|
||||
}
|
||||
} catch (error) {
|
||||
this.showError(`Error saving API keys: ${error.message}`);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset API Key fields
|
||||
*/
|
||||
resetApiKeys() {
|
||||
const inputs = this.elements.apiKeyInputs.querySelectorAll('input');
|
||||
inputs.forEach(input => {
|
||||
input.value = '';
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Make API call to server
|
||||
* @param {string} endpoint - API endpoint
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user