( image: File, onProcessing?: (file: File) => void, )
| 1175 | export const uploadNotAcceptedMessage = `File type is not allowed or the size exceeded the limit of ${imageSizeLimitMB} MB`; |
| 1176 | |
| 1177 | export const uploadContentImage = async ( |
| 1178 | image: File, |
| 1179 | onProcessing?: (file: File) => void, |
| 1180 | ): Promise<string> => { |
| 1181 | if (image.size > allowedFileSize) { |
| 1182 | throw new Error(`File size exceeds the limit of ${imageSizeLimitMB} MB`); |
| 1183 | } |
| 1184 | |
| 1185 | if (!allowedContentImage.includes(image.type)) { |
| 1186 | throw new Error('File type is not allowed'); |
| 1187 | } |
| 1188 | |
| 1189 | if (onProcessing) { |
| 1190 | onProcessing(image); |
| 1191 | } |
| 1192 | |
| 1193 | const res = await gqlClient.request(UPLOAD_IMAGE_MUTATION, { image }); |
| 1194 | |
| 1195 | return res.uploadContentImage; |
| 1196 | }; |
| 1197 | |
| 1198 | export enum PostRelationType { |
| 1199 | Collection = 'COLLECTION', |
no outgoing calls
no test coverage detected