This commit is contained in:
alorig
2025-11-22 20:51:07 +05:00
parent e2c0d3d0fc
commit d4990fb088
4 changed files with 98 additions and 6 deletions

View File

@@ -199,10 +199,11 @@ export default function WordPressIntegrationForm({
}
} else if (enabled && apiKey) {
// Create integration when enabling for first time
// Use API key-only authentication (no username/password required)
await integrationApi.saveWordPressIntegration(siteId, {
url: siteUrl || '',
username: '',
app_password: '',
username: '', // Optional when using API key
app_password: '', // Optional when using API key
api_key: apiKey,
is_active: enabled,
sync_enabled: true,
@@ -214,6 +215,10 @@ export default function WordPressIntegrationForm({
if (onIntegrationUpdate && updated) {
onIntegrationUpdate(updated);
}
} else if (enabled && !apiKey) {
// Toggle enabled but no API key - show error
toast.error('API key is required to enable WordPress integration');
setIntegrationEnabled(false);
}
} catch (error: any) {
toast.error(`Failed to update integration: ${error.message}`);