aboutsummaryrefslogtreecommitdiffstats
path: root/src/pages/CallbackPage.tsx
blob: 00feb7629506404f3af122b0c0a36fa2dfdce841 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/** @jsx jsx */
import { jsx } from "@emotion/react";
import { useState } from "react";

export default function CallbackPage(): JSX.Element {
    const [hasSent, setHasSent] = useState(false);
    const params = new URLSearchParams(location.search);

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

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

    return <div/>;
}