aboutsummaryrefslogtreecommitdiff
path: root/src/client/Network.ts
diff options
context:
space:
mode:
authorkimdahey <claire_kim1@brown.edu>2019-12-03 16:32:13 -0500
committerkimdahey <claire_kim1@brown.edu>2019-12-03 16:32:13 -0500
commit70583fa47bd9920d1823d381708c81283534d6ce (patch)
tree5c81976813436852403ea352797efe1d518dbb1a /src/client/Network.ts
parent56b83d89f37a5523ab319977e3385f539ecaf996 (diff)
parent213962406327cc2f7267064f3016fabf0fd16872 (diff)
merged w master
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