mirror of
https://github.com/alkimake/paperclip.git
synced 2026-06-16 10:50:38 +09:00
15 lines
450 B
TypeScript
15 lines
450 B
TypeScript
|
|
import type { AssetImage } from "@paperclip/shared";
|
||
|
|
import { api } from "./client";
|
||
|
|
|
||
|
|
export const assetsApi = {
|
||
|
|
uploadImage: (companyId: string, file: File, namespace?: string) => {
|
||
|
|
const form = new FormData();
|
||
|
|
form.append("file", file);
|
||
|
|
if (namespace && namespace.trim().length > 0) {
|
||
|
|
form.append("namespace", namespace.trim());
|
||
|
|
}
|
||
|
|
return api.postForm<AssetImage>(`/companies/${companyId}/assets/images`, form);
|
||
|
|
},
|
||
|
|
};
|
||
|
|
|