blob: f458f6c451dbb5a09ab4e4f3c78f46154ce9a48b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
export function uploadDocumentImages(files: Array<File>): Promise<Response> {
if (files.length <= 0) throw new Error("files.length was " + files.length);
const data = new FormData();
for (const file of files)
data.append("files", file);
return fetch("/api/documents/upload-images", {
method: "post",
body: data
});
}
export function getDocument(documentType: string) {
return fetch("/api/documents/" + documentType);
}
export function setDocument(documentType: string, content: string) {
const fd = new FormData();
fd.append("content", content);
return fetch("/api/documents/" + documentType, {
method: "post",
body: fd,
});
}
|