feat(ui): add utils for getting images from canvas

This commit is contained in:
psychedelicious
2024-06-21 16:00:42 +10:00
parent 04df9f5873
commit 1b2d045be1
15 changed files with 277 additions and 241 deletions

View File

@@ -588,3 +588,16 @@ export const getImageDTO = async (image_name: string, forceRefetch?: boolean): P
return null;
}
};
export const uploadImage = async (
blob: Blob,
fileName: string,
image_category: ImageCategory,
is_intermediate: boolean
): Promise<ImageDTO> => {
const { dispatch } = getStore();
const file = new File([blob], fileName, { type: 'image/png' });
const req = dispatch(imagesApi.endpoints.uploadImage.initiate({ file, image_category, is_intermediate }));
req.reset();
return await req.unwrap();
};