diff --git a/frontend/src/components/authorization/AuthorizationLoginBox.tsx b/frontend/src/components/authorization/AuthorizationLoginBox.tsx index 54fb376..afbc02d 100644 --- a/frontend/src/components/authorization/AuthorizationLoginBox.tsx +++ b/frontend/src/components/authorization/AuthorizationLoginBox.tsx @@ -21,7 +21,7 @@ export function AuthorizationLoginBox(): JSX.Element { const canLogin = React.useMemo( () => ( - axios !== undefined && authorization !== undefined && !authorization.state.running && authorization.state.token === undefined + axios !== undefined && authorization !== undefined && authorization.state.token === undefined ), [axios, authorization, username, password], ) @@ -29,9 +29,9 @@ export function AuthorizationLoginBox(): JSX.Element { const canClickLogin = React.useMemo( () => ( - canLogin && username.value !== "" && password.value !== "" + canLogin && !authorization!.state.running && username.value !== "" && password.value !== "" ), - [canLogin, username, password], + [authorization, canLogin, username, password], ) const doLogin = @@ -70,6 +70,23 @@ export function AuthorizationLoginBox(): JSX.Element { [axios, authorization, username, password], ) + const buttonColor = + React.useMemo( + () => { + if(!authorization) { + return "" + } + if(authorization.state.running) { + return "color-yellow" + } + if(error) { + return "color-red" + } + return "" + }, + [authorization, error], + ) + const buttonText = React.useMemo( () => { @@ -96,10 +113,10 @@ export function AuthorizationLoginBox(): JSX.Element { If you do not have one, you can ask your system administrator to create one for you.

- - + + - + {buttonText}