aboutsummaryrefslogtreecommitdiff
path: root/src/Utils.ts
diff options
context:
space:
mode:
authorbob <bcz@cs.brown.edu>2019-12-02 13:22:02 -0500
committerbob <bcz@cs.brown.edu>2019-12-02 13:22:02 -0500
commit1ef06e189a352e5472ee267d44d4b3c96042f03c (patch)
treeeefed629be388e83dc71a7b3c574326fc0343f06 /src/Utils.ts
parent1280c005829cf49fd106fd872afcf4ed6593a2f6 (diff)
parent0595f93dde717b7b6990e9a81c5b43a73a3808d5 (diff)
Merge branch 'master' of https://github.com/browngraphicslab/Dash-Web
Diffstat (limited to 'src/Utils.ts')
-rw-r--r--src/Utils.ts10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/Utils.ts b/src/Utils.ts
index 37b509370..2543743a4 100644
--- a/src/Utils.ts
+++ b/src/Utils.ts
@@ -2,7 +2,6 @@ import v4 = require('uuid/v4');
import v5 = require("uuid/v5");
import { Socket } from 'socket.io';
import { Message } from './server/Message';
-import { RouteStore } from './server/RouteStore';
export namespace Utils {
@@ -46,7 +45,12 @@ export namespace Utils {
}
export function CorsProxy(url: string): string {
- return prepend(RouteStore.corsProxy + "/") + encodeURIComponent(url);
+ return prepend("/corsProxy/") + encodeURIComponent(url);
+ }
+
+ export async function getApiKey(target: string): Promise<string> {
+ const response = await fetch(prepend(`environment/${target.toUpperCase()}`));
+ return response.text();
}
export function CopyText(text: string) {
@@ -255,7 +259,7 @@ export namespace Utils {
}
let idString = (message.id || "").padStart(36, ' ');
prefix = prefix.padEnd(16, ' ');
- console.log(`${prefix}: ${idString}, ${receiving ? 'receiving' : 'sending'} ${messageName} with data ${JSON.stringify(message)}`);
+ console.log(`${prefix}: ${idString}, ${receiving ? 'receiving' : 'sending'} ${messageName} with data ${JSON.stringify(message)} `);
}
function loggingCallback(prefix: string, func: (args: any) => any, messageName: string) {