MCPcopy Create free account
hub / github.com/dailydotdev/apps / uploadContentImage

Function uploadContentImage

packages/shared/src/graphql/posts.ts:1186–1205  ·  view source on GitHub ↗
(
  image: File,
  onProcessing?: (file: File) => void,
)

Source from the content-addressed store, hash-verified

1184export const uploadNotAcceptedMessage = `File type is not allowed or the size exceeded the limit of ${imageSizeLimitMB} MB`;
1185
1186export const uploadContentImage = async (
1187 image: File,
1188 onProcessing?: (file: File) => void,
1189): Promise<string> => {
1190 if (image.size > allowedFileSize) {
1191 throw new Error(`File size exceeds the limit of ${imageSizeLimitMB} MB`);
1192 }
1193
1194 if (!allowedContentImage.includes(image.type)) {
1195 throw new Error('File type is not allowed');
1196 }
1197
1198 if (onProcessing) {
1199 onProcessing(image);
1200 }
1201
1202 const res = await gqlClient.request(UPLOAD_IMAGE_MUTATION, { image });
1203
1204 return res.uploadContentImage;
1205};
1206
1207export enum PostRelationType {
1208 Collection = 'COLLECTION',

Callers 5

FeedbackModalFunction · 0.90
handleSubmitFunction · 0.90
onScreenshotSelectFunction · 0.90
handleIconBase64Function · 0.90
uploadImageFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected