Section 2 COmpleted
This commit is contained in:
@@ -194,8 +194,34 @@ export default function ContentSettingsPage() {
|
||||
});
|
||||
}
|
||||
|
||||
// TODO: Load content generation settings when API is available
|
||||
// TODO: Load publishing settings when API is available
|
||||
// Load content generation settings
|
||||
try {
|
||||
const contentData = await fetchAPI('/v1/system/settings/content/content_generation/');
|
||||
if (contentData?.config) {
|
||||
setContentSettings({
|
||||
appendToPrompt: contentData.config.append_to_prompt || '',
|
||||
defaultTone: contentData.config.default_tone || 'professional',
|
||||
defaultLength: contentData.config.default_length || 'medium',
|
||||
});
|
||||
}
|
||||
} catch (err) {
|
||||
// Settings may not exist yet, use defaults
|
||||
console.log('Content generation settings not found, using defaults');
|
||||
}
|
||||
|
||||
// Load publishing settings
|
||||
try {
|
||||
const publishData = await fetchAPI('/v1/system/settings/content/publishing/');
|
||||
if (publishData?.config) {
|
||||
setPublishingSettings({
|
||||
autoPublishEnabled: publishData.config.auto_publish_enabled || false,
|
||||
autoSyncEnabled: publishData.config.auto_sync_enabled || false,
|
||||
});
|
||||
}
|
||||
} catch (err) {
|
||||
// Settings may not exist yet, use defaults
|
||||
console.log('Publishing settings not found, using defaults');
|
||||
}
|
||||
|
||||
} catch (error: any) {
|
||||
console.error('Error loading content settings:', error);
|
||||
@@ -231,8 +257,32 @@ export default function ContentSettingsPage() {
|
||||
});
|
||||
}
|
||||
|
||||
// TODO: Save content generation settings when API is available
|
||||
// TODO: Save publishing settings when API is available
|
||||
// Save content generation settings
|
||||
if (activeTab === 'content') {
|
||||
await fetchAPI('/v1/system/settings/content/content_generation/save/', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
config: {
|
||||
append_to_prompt: contentSettings.appendToPrompt,
|
||||
default_tone: contentSettings.defaultTone,
|
||||
default_length: contentSettings.defaultLength,
|
||||
}
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
||||
// Save publishing settings
|
||||
if (activeTab === 'publishing') {
|
||||
await fetchAPI('/v1/system/settings/content/publishing/save/', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
config: {
|
||||
auto_publish_enabled: publishingSettings.autoPublishEnabled,
|
||||
auto_sync_enabled: publishingSettings.autoSyncEnabled,
|
||||
}
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
||||
toast.success('Settings saved successfully');
|
||||
} catch (error: any) {
|
||||
|
||||
Reference in New Issue
Block a user