Make API key and CORS settings per-company
- saatavuus endpoint finds company by API key, searches only that company - config/config_update/generate_api_key now use company config - API tab shows active company name - Each company has own api_key and cors_origins in their config.json Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1643,7 +1643,10 @@ async function loadSettings() {
|
||||
try {
|
||||
const config = await apiCall('config');
|
||||
document.getElementById('settings-api-key').value = config.api_key || '';
|
||||
document.getElementById('settings-cors').value = (config.cors_origins || ['https://cuitunet.fi', 'https://www.cuitunet.fi']).join('\n');
|
||||
document.getElementById('settings-cors').value = (config.cors_origins || []).join('\n');
|
||||
// Näytä yrityksen nimi API-otsikossa
|
||||
const apiTitle = document.getElementById('api-company-name');
|
||||
if (apiTitle && currentCompany) apiTitle.textContent = currentCompany.nimi + ' — ';
|
||||
const key = config.api_key || 'AVAIN';
|
||||
document.getElementById('api-example-url').textContent = `api.php?action=saatavuus&key=${key}&osoite=Kauppakatu+5&postinumero=20100&kaupunki=Turku`;
|
||||
} catch (e) { console.error(e); }
|
||||
|
||||
Reference in New Issue
Block a user