From cf37e19f281143ff6f9a35d45b7911e65fb8e98d Mon Sep 17 00:00:00 2001 From: Joe Banks Date: Tue, 6 Oct 2020 14:38:33 +0100 Subject: When a code is received post it back to the opener --- src/pages/CallbackPage.tsx | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 src/pages/CallbackPage.tsx (limited to 'src/pages') diff --git a/src/pages/CallbackPage.tsx b/src/pages/CallbackPage.tsx new file mode 100644 index 0000000..caa384f --- /dev/null +++ b/src/pages/CallbackPage.tsx @@ -0,0 +1,17 @@ +/** @jsx jsx */ +import { jsx } from "@emotion/core"; +import { useState } from "react"; + +export default function CallbackPage() { + const [hasSent, setHasSent] = useState(false); + const params = new URLSearchParams(document.location.search); + + const code = params.get("code"); + + if (!hasSent) { + setHasSent(true); + window.opener.postMessage(code); + } + + return

Code is {code}

; +} -- cgit v1.2.3 From e2f150000933b8d51de46da91aa60206db09baa3 Mon Sep 17 00:00:00 2001 From: Joe Banks Date: Tue, 6 Oct 2020 14:38:42 +0100 Subject: Re-add the OAuth2 button to the home page --- src/pages/LandingPage.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/pages') diff --git a/src/pages/LandingPage.tsx b/src/pages/LandingPage.tsx index 60deb30..2e2bfd6 100644 --- a/src/pages/LandingPage.tsx +++ b/src/pages/LandingPage.tsx @@ -5,6 +5,7 @@ import HeaderBar from "../components/HeaderBar"; import FormListing from "../components/FormListing"; import { getForms } from "../api/forms"; +import OAuth2Button from "../components/OAuth2Button"; function LandingPage() { return
@@ -17,7 +18,9 @@ function LandingPage() { flex-direction: column; `}>

Available Forms

- + + + {getForms().map(form => ( -- cgit v1.2.3