From 5f1b5f10396f647f0028c1fbfaf38c4927b6f0ff Mon Sep 17 00:00:00 2001 From: Nicholas Orlowsky Date: Sun, 9 Jul 2023 18:23:29 -0400 Subject: [PATCH] add enable ssl --- .idea/workspace.xml | 6 ++++++ src/components/DashboardPage.tsx | 11 ++++++++++- src/index.tsx | 4 ---- src/nws-api/calls.ts | 9 +++++++++ 4 files changed, 25 insertions(+), 5 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 6984bff..f420672 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -3,7 +3,9 @@ + + + + + @@ -65,6 +70,7 @@ + diff --git a/src/components/DashboardPage.tsx b/src/components/DashboardPage.tsx index dbf9c62..04b5cb2 100644 --- a/src/components/DashboardPage.tsx +++ b/src/components/DashboardPage.tsx @@ -1,4 +1,4 @@ -import {Account, Namespace, Service} from "../nws-api/types"; +import {Account, Namespace, Service, SessionKey} from "../nws-api/types"; import { useGetAccountNamespaces, useGetAccountServices, @@ -7,6 +7,7 @@ import { useNWSAccount } from "../nws-api/hooks"; import {useState} from "react"; +import {enableSSL} from "../nws-api/calls"; export default function DashboardPage() { @@ -44,6 +45,14 @@ export default function DashboardPage() {

{e.serviceName}

Application Id

{e.serviceId}

+ { + let rawSession: string | null = localStorage.getItem("session_key"); + + if(rawSession != null) { + let session: SessionKey = JSON.parse(rawSession); + await enableSSL(account!.id!, e.serviceId, session); + } + }}>Enable SSL ); })} diff --git a/src/index.tsx b/src/index.tsx index 96855c6..5663240 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -27,10 +27,6 @@ function Layout (props: {children: any}) { return (
-
-

Fly Eagles Fly

- -
diff --git a/src/nws-api/calls.ts b/src/nws-api/calls.ts index cf8dae9..a895602 100644 --- a/src/nws-api/calls.ts +++ b/src/nws-api/calls.ts @@ -49,3 +49,12 @@ export async function getNamespaces(accountId: string, skey: SessionKey): Promis let namespaces: Namespace[] = await response.json(); return namespaces; } + +export async function enableSSL(accountId: string, serviceId: string, skey: SessionKey) { + await fetch('https://api-nws.nickorlow.com/'+accountId+'/services/'+serviceId+"/ssl", { + headers: { + Authorization: skey.id + }, + method: "POST" + }); +}