automatically detect image types and set primary photo if first

This commit is contained in:
Hayden 2023-12-01 11:45:20 -06:00
parent 3f455cb574
commit 51e3ad11c4
No known key found for this signature in database
GPG key ID: 17CF79474E257545
4 changed files with 39 additions and 9 deletions

View file

@ -28,10 +28,12 @@ export type ItemsQuery = {
};
export class AttachmentsAPI extends BaseAPI {
add(id: string, file: File | Blob, filename: string, type: AttachmentTypes) {
add(id: string, file: File | Blob, filename: string, type: AttachmentTypes | null = null) {
const formData = new FormData();
formData.append("file", file);
formData.append("type", type);
if (type) {
formData.append("type", type);
}
formData.append("name", filename);
return this.http.post<FormData, ItemOut>({