mirror of
https://github.com/hay-kot/homebox.git
synced 2025-06-10 06:22:27 +00: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:
parent
bd1a241be1
commit
81e76d9dd4
13 changed files with 41 additions and 424 deletions
|
@ -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>({
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue