aboutsummaryrefslogtreecommitdiffstats
path: root/src/pages/CallbackPage.tsx
blob: d085d28173b5ad433c51062aba1e2f729e718c3d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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(location.search);

    const code = params.get("code");

    if (!hasSent) {
        setHasSent(true);
        window.opener.postMessage(code);
    }

    return <p>Code is {code}</p>;
}