diff options
Diffstat (limited to 'src/wwwroot/scripts/api/documents-api.ts')
| -rw-r--r-- | src/wwwroot/scripts/api/documents-api.ts | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/wwwroot/scripts/api/documents-api.ts b/src/wwwroot/scripts/api/documents-api.ts new file mode 100644 index 0000000..f458f6c --- /dev/null +++ b/src/wwwroot/scripts/api/documents-api.ts @@ -0,0 +1,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, + }); +}
\ No newline at end of file |
