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