diff --git a/packages/shared/src/graphql/posts.ts b/packages/shared/src/graphql/posts.ts index 937a04e195..5871afd723 100644 --- a/packages/shared/src/graphql/posts.ts +++ b/packages/shared/src/graphql/posts.ts @@ -960,12 +960,17 @@ export type CreatePostInMultipleSourcesResponse = Array<{ export const createPostInMultipleSources = async ( variables: CreatePostInMultipleSourcesArgs, ) => { + const { image, ...rest } = variables; + const sanitized = { + ...rest, + ...(image instanceof File && image.size > 0 ? { image } : {}), + }; const res = await gqlClient.request< { createPostInMultipleSources: CreatePostInMultipleSourcesResponse; }, CreatePostInMultipleSourcesArgs - >(CREATE_POST_IN_MULTIPLE_SOURCES, variables); + >(CREATE_POST_IN_MULTIPLE_SOURCES, sanitized); return res.createPostInMultipleSources; }; diff --git a/packages/webapp/pages/squads/create.tsx b/packages/webapp/pages/squads/create.tsx index 558bf9d91c..cbf8d94701 100644 --- a/packages/webapp/pages/squads/create.tsx +++ b/packages/webapp/pages/squads/create.tsx @@ -182,10 +182,11 @@ function CreatePost(): ReactElement { return; } - const { options, ...args } = params; + const { options, image, ...args } = params; await onCreate({ ...args, + ...(image instanceof File && image.size > 0 && { image }), ...(options?.length && { options: options.map((text, order) => ({ text,