redundancy removal
This commit is contained in:
		
							parent
							
								
									60cd649961
								
							
						
					
					
						commit
						ceb2d2fffc
					
				@ -224,12 +224,6 @@ class DNScopeApp {
 | 
				
			|||||||
                    if (e.target === this.elements.settingsModal) this.hideSettingsModal();
 | 
					                    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
 | 
					            // Setup new handlers
 | 
				
			||||||
            const saveSettingsBtn = document.getElementById('save-settings');
 | 
					            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
 | 
					     * Make API call to server
 | 
				
			||||||
     * @param {string} endpoint - API endpoint
 | 
					     * @param {string} endpoint - API endpoint
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user