import React from "react";
import { styled } from "styled-components";
import { HashLoader } from "react-spinners";
import { SigninResponse, SigninState } from 'oidc-client-ts';

const CenterContainer = styled.div`
    position: relative;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 400px;
    text-align: center;

    & h2 {
        font-size: 1.8em;
        font-weight: 600;
        margin: 1.5em 0;
    }
`;

export default class LoggedIn extends React.Component {
    constructor(props) {
        super(props);
        this.response = new SigninResponse(new URL(window.location.href).searchParams);
        this.signin_state = SigninState.fromStorageString(window.localStorage.getItem('oidc_signin_state'));
    }

    async componentDidMount() {
        console.log(this.response)
    }

    render() {
        return (
            <div style={{height: '65vh'}}>
                <CenterContainer>
                    <h2>Подождите пожалуйста</h2>
                    <div style={{margin: '36px auto', width:'fit-content'}}>
                        <HashLoader size='80' color='#0077aa' />
                    </div>
                </CenterContainer>
            </div>
        )
    }
}