fix: omit empty image array and bogus id from post value items
Sending image:[] causes a 400 from the Postiz API — only include the image field when there is actual media to attach. Also remove the id:"" field which was never valid. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -143,10 +143,16 @@ export default function ComposeScreen() {
|
|||||||
date: postNow ? new Date().toISOString() : scheduleDate.toISOString(),
|
date: postNow ? new Date().toISOString() : scheduleDate.toISOString(),
|
||||||
shortLink: false,
|
shortLink: false,
|
||||||
tags: [] as string[],
|
tags: [] as string[],
|
||||||
posts: selectedChannels.map((integrationId) => ({
|
posts: selectedChannels.map((integrationId) => {
|
||||||
integration: { id: integrationId },
|
const valueItem: { content: string; image?: Array<{ id: string; path: string }> } = {
|
||||||
value: [{ content: content.trim(), id: "", image: media }],
|
content: content.trim(),
|
||||||
})),
|
};
|
||||||
|
if (media.length > 0) valueItem.image = media;
|
||||||
|
return {
|
||||||
|
integration: { id: integrationId },
|
||||||
|
value: [valueItem],
|
||||||
|
};
|
||||||
|
}),
|
||||||
};
|
};
|
||||||
const body = JSON.stringify(payload);
|
const body = JSON.stringify(payload);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user