18 lines
365 B
TypeScript
18 lines
365 B
TypeScript
import { api } from './http';
|
|
|
|
export interface UploadedImage {
|
|
url: string;
|
|
name: string;
|
|
size: number;
|
|
mime: string;
|
|
}
|
|
|
|
export const ImageAPI = {
|
|
upload: (files: File[]) => {
|
|
const fd = new FormData();
|
|
files.forEach((f) => fd.append('file', f));
|
|
return api.post<{ files: UploadedImage[] }>('/uploads/image', fd).then((r) => r.data);
|
|
}
|
|
};
|
|
|