aboutsummaryrefslogtreecommitdiff
path: root/src/client/Network.ts
diff options
context:
space:
mode:
authorGeireann Lindfield Roberts <60007097+geireann@users.noreply.github.com>2022-07-01 12:20:19 -0700
committerGeireann Lindfield Roberts <60007097+geireann@users.noreply.github.com>2022-07-01 12:20:19 -0700
commit2e95a659dfaa37ecdea89866a8df3d4f9bbdecfe (patch)
treef92d8a74854748d12016209a208aa35331761fbc /src/client/Network.ts
parentda19cbc10d28b2e39a6592b80880106a415acc1c (diff)
parent9da331c1a430625b136acbaa515d33448f96d495 (diff)
Merge branch 'master' into geireann-eslint-prettier
Diffstat (limited to 'src/client/Network.ts')
-rw-r--r--src/client/Network.ts10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/client/Network.ts b/src/client/Network.ts
index 3597e7b2b..c781d4b6b 100644
--- a/src/client/Network.ts
+++ b/src/client/Network.ts
@@ -18,6 +18,13 @@ export namespace Networking {
return requestPromise.post(options);
}
+ /**
+ * Handles uploading basic file types to server and makes the API call to "/uploadFormData" endpoint
+ * with the mapping of GUID to filem as parameters.
+ *
+ * @param files the files to be uploaded to the server
+ * @returns the response as a json from the server
+ */
export async function UploadFilesToServer<T extends Upload.FileInformation = Upload.FileInformation>(files: File | File[]): Promise<Upload.FileResponse<T>[]> {
const formData = new FormData();
if (Array.isArray(files)) {
@@ -35,7 +42,7 @@ export namespace Networking {
const response = await fetch("/uploadFormData", parameters);
return response.json();
}
-
+
export async function UploadYoutubeToServer<T extends Upload.FileInformation = Upload.FileInformation>(videoId: string): Promise<Upload.FileResponse<T>[]> {
const parameters = {
method: 'POST',
@@ -45,5 +52,6 @@ export namespace Networking {
const response = await fetch("/uploadYoutubeVideo", parameters);
return response.json();
}
+
} \ No newline at end of file