mirror of
https://github.com/sysadminsmedia/homebox.git
synced 2025-12-24 14:31:55 +01:00
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:
@@ -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>({
|
||||
|
||||
Reference in New Issue
Block a user