aboutsummaryrefslogtreecommitdiff
path: root/src/client/Network.ts
diff options
context:
space:
mode:
authorStanley Yip <stanley_yip@brown.edu>2020-01-08 13:47:29 -0500
committerStanley Yip <stanley_yip@brown.edu>2020-01-08 13:47:29 -0500
commitabfa42b6f2cf863deee19aac19328a23687464cb (patch)
treeb481f23ffa7bccbde7a31de34f50d765b6b73162 /src/client/Network.ts
parentd8fc218f3481728f221ceacc60ac4bc553f8e295 (diff)
parent19a71cb2788b9c1c8d8ced4af285bf91033ba626 (diff)
Merge branch 'master' of https://github.com/browngraphicslab/Dash-Web into pen
Diffstat (limited to 'src/client/Network.ts')
-rw-r--r--src/client/Network.ts14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/client/Network.ts b/src/client/Network.ts
index 75ccb5e99..ccf60f199 100644
--- a/src/client/Network.ts
+++ b/src/client/Network.ts
@@ -1,18 +1,16 @@
import { Utils } from "../Utils";
-import { CurrentUserUtils } from "../server/authentication/models/current_user_utils";
import requestPromise = require('request-promise');
-export namespace Identified {
+export namespace Networking {
export async function FetchFromServer(relativeRoute: string) {
- return (await fetch(relativeRoute, { headers: { userId: CurrentUserUtils.id } })).text();
+ return (await fetch(relativeRoute)).text();
}
export async function PostToServer(relativeRoute: string, body?: any) {
- let options = {
+ const options = {
uri: Utils.prepend(relativeRoute),
method: "POST",
- headers: { userId: CurrentUserUtils.id },
body,
json: true
};
@@ -22,12 +20,10 @@ export namespace Identified {
export async function PostFormDataToServer(relativeRoute: string, formData: FormData) {
const parameters = {
method: 'POST',
- headers: { userId: CurrentUserUtils.id },
- body: formData,
+ body: formData
};
const response = await fetch(relativeRoute, parameters);
- const text = await response.json();
- return text;
+ return response.json();
}
} \ No newline at end of file