( image: File, onProcessing?: (file: File) => void, )
| 1184 | export const uploadNotAcceptedMessage = `File type is not allowed or the size exceeded the limit of ${imageSizeLimitMB} MB`; |
| 1185 | |
| 1186 | export 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 | |
| 1207 | export enum PostRelationType { |
| 1208 | Collection = 'COLLECTION', |
no outgoing calls
no test coverage detected