diff --git a/ui/login.tsx b/ui/login.tsx index f63a764..18eb193 100644 --- a/ui/login.tsx +++ b/ui/login.tsx @@ -22,11 +22,55 @@ import React from 'react' import ReactDOM from 'react-dom/client' import './main.css' -import { Button, Card, Flex, Typography } from 'antd' -import { GithubOutlined, GoogleOutlined } from '@ant-design/icons' +import { Button, Card, Flex, Spin, Typography } from 'antd' +import { GithubOutlined, GoogleOutlined, Loading3QuartersOutlined, LoadingOutlined } from '@ant-design/icons' -class App extends React.Component { +interface AppState { + is_loading: boolean; +} +class App extends React.Component<{}, AppState> { + constructor(props: {}) { + super(props) + this.state = { + is_loading: true + } + } + + componentDidMount(): void { + fetch('/.auth/refresh').then((response) => { + if (response.ok) { + window.location.href = '/index.html' + } + }).finally(() => { + this.setState({ is_loading: false }) + }); + } + + renderCallToAction() { + if (this.state.is_loading) { + return ( + } /> + ) + } else { + ( + <> + + + + ) + } + } render(): React.ReactNode { return ( <> @@ -34,18 +78,7 @@ class App extends React.Component { BudgetBud - - + {this.renderCallToAction()}