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