Created the Code.jsx page

This commit is contained in:
Mathias Wagner 2023-11-13 11:49:31 +01:00
parent b837295bbb
commit 32f218bedb
Signed by: Mathias
GPG Key ID: B8DC354B0A1F5B44

26
src/states/Code/Code.jsx Normal file
View File

@ -0,0 +1,26 @@
import {FontAwesomeIcon} from "@fortawesome/react-fontawesome";
import Button from "@/common/components/Button";
import {faCheckCircle} from "@fortawesome/free-solid-svg-icons";
import "./styles.sass";
import {AUTH_URL} from "@/App.jsx";
import {useEffect} from "react";
export const Code = () => {
const urlParams = new URLSearchParams(window.location.search);
const code = urlParams.get('code');
useEffect(() => {
if (code) {
localStorage.setItem("code", code);
}
}, []);
return (
<div className="code-page">
{code && <FontAwesomeIcon icon={faCheckCircle}/>}
{!code && <Button onClick={() => location.href = AUTH_URL}>Try Again</Button>}
</div>
);
}