add enable ssl

This commit is contained in:
Nicholas Orlowsky 2023-07-09 18:23:29 -04:00
parent d3813e1107
commit 5f1b5f1039
4 changed files with 25 additions and 5 deletions

View file

@ -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() {
<h3>{e.serviceName}</h3>
<p><b>Application Id</b></p>
<p>{e.serviceId}</p>
<a onClick={async ()=> {
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</a>
</div>
</div>);
})}

View file

@ -27,10 +27,6 @@ function Layout (props: {children: any}) {
return (
<div>
<header className={"w-100 sticky-top"}>
<div className={"w-100 d-flex justify-content-center align-content-center text-center p-1 "} style={{backgroundColor: "#004C54", height: 30}} >
<p className={"text-white fw-bold"}>Fly Eagles Fly</p>
<img src={"https://logos-world.net/wp-content/uploads/2020/05/Philadelphia-Eagles-Logo.png"} style={{maxHeight: "100%", maxWidth: "100%"}}/>
</div>
<div className={"w-100"}>
<Navbar sticky={"top"} expand="lg" className={"row justify-content-center m-0 p-0"} style={{backgroundColor: "#eee"}}>
<div className={"row w-100"}>

View file

@ -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"
});
}