( image: File, onProcessing?: (file: File) => void, )
| 1252 | export const uploadNotAcceptedMessage = `File type is not allowed or the size exceeded the limit of ${imageSizeLimitMB} MB`; |
| 1253 | |
| 1254 | export const uploadContentImage = async ( |
| 1255 | image: File, |
| 1256 | onProcessing?: (file: File) => void, |
| 1257 | ): Promise<string> => { |
| 1258 | if (image.size > allowedFileSize) { |
| 1259 | throw new Error(`File size exceeds the limit of ${imageSizeLimitMB} MB`); |
| 1260 | } |
| 1261 | |
| 1262 | if (!allowedContentImage.includes(image.type)) { |
| 1263 | throw new Error('File type is not allowed'); |
| 1264 | } |
| 1265 | |
| 1266 | if (onProcessing) { |
| 1267 | onProcessing(image); |
| 1268 | } |
| 1269 | |
| 1270 | const res = await gqlClient.request(UPLOAD_IMAGE_MUTATION, { image }); |
| 1271 | |
| 1272 | return res.uploadContentImage; |
| 1273 | }; |
| 1274 | |
| 1275 | export enum PostRelationType { |
| 1276 | Collection = 'COLLECTION', |
no outgoing calls
no test coverage detected