import React, {createContext, useEffect, useState} from 'react' import {Button, Card} from 'antd' import {t} from 'ttag' import TextPage from './TextPage' import {LoginForm} from '../components/LoginForm' import type { InstanceConfig} from '../utils/api' import {getConfiguration} from '../utils/api' import {RegisterForm} from '../components/RegisterForm' export const AuthenticatedContext = createContext< { authenticated: (authenticated: boolean) => void setIsAuthenticated: React.Dispatch> } >({ authenticated: () => { }, setIsAuthenticated: () => { } }) export default function LoginPage() { const [wantRegister, setWantRegister] = useState(false) const [configuration, setConfiguration] = useState() const toggleWantRegister = () => { setWantRegister(!wantRegister) } useEffect(() => { getConfiguration().then(setConfiguration) }, []) return ( {wantRegister ? : } { configuration?.registerEnabled && } ) }