diff options
author | Sam Wilkins <samwilkins333@gmail.com> | 2019-11-19 11:18:08 -0500 |
---|---|---|
committer | Sam Wilkins <samwilkins333@gmail.com> | 2019-11-19 11:18:08 -0500 |
commit | 00633c834c725bab78cef5bd7b9c4ff2b1449ccf (patch) | |
tree | 3b9787605911259e1e119c385a7f61acf3fa5d87 /src/Utils.ts | |
parent | 0690b9aebb4ccbf9925c48678525d8e4669c52e2 (diff) |
api key route switched to environment, added client side util
Diffstat (limited to 'src/Utils.ts')
-rw-r--r-- | src/Utils.ts | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/Utils.ts b/src/Utils.ts index abff2eaba..91fa459c6 100644 --- a/src/Utils.ts +++ b/src/Utils.ts @@ -48,6 +48,11 @@ export namespace Utils { 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) { var textArea = document.createElement("textarea"); textArea.value = text; @@ -174,7 +179,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) { |