fix/feat: primary photo auto set and auto-set primary photo (#651)

* fix error when item doesn't have photo attachment

* automatically detect image types and set primary photo if first

* remove charts.js from libs

Former-commit-id: 321a83b634
This commit is contained in:
Hayden 2023-12-01 11:57:29 -06:00 committed by GitHub
parent bd1a241be1
commit 81e76d9dd4
13 changed files with 41 additions and 424 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>({