feat: Implement WordPress publishing and unpublishing actions

- Added conditional visibility for table actions based on content state (published/draft).
- Introduced `publishContent` and `unpublishContent` API functions for handling WordPress integration.
- Updated `Content` component to manage publish/unpublish actions with appropriate error handling and success notifications.
- Refactored `PostEditor` to remove deprecated SEO fields and consolidate taxonomy management.
- Enhanced `TablePageTemplate` to filter row actions based on visibility conditions.
- Updated backend API to support publishing and unpublishing content with proper status updates and external references.
This commit is contained in:
alorig
2025-11-26 01:24:58 +05:00
parent ba842d8332
commit 53ea0c34ce
13 changed files with 1249 additions and 417 deletions

View File

@@ -2074,6 +2074,38 @@ export async function fetchContentById(id: number): Promise<Content> {
return fetchAPI(`/v1/writer/content/${id}/`);
}
// Content Publishing API
export interface PublishContentResult {
content_id: number;
status: string;
external_id: string;
external_url: string;
message?: string;
}
export interface UnpublishContentResult {
content_id: number;
status: string;
message?: string;
}
export async function publishContent(id: number, site_id?: number): Promise<PublishContentResult> {
const body: { site_id?: number } = {};
if (site_id !== undefined) {
body.site_id = site_id;
}
return fetchAPI(`/v1/writer/content/${id}/publish/`, {
method: 'POST',
body: JSON.stringify(body),
});
}
export async function unpublishContent(id: number): Promise<UnpublishContentResult> {
return fetchAPI(`/v1/writer/content/${id}/unpublish/`, {
method: 'POST',
});
}
// Stage 3: Content Validation API
export interface ContentValidationResult {
content_id: number;