diff --git a/frontend/src/pages/log-in.ts b/frontend/src/pages/log-in.ts index 5cf77626..a4860c84 100644 --- a/frontend/src/pages/log-in.ts +++ b/frontend/src/pages/log-in.ts @@ -29,6 +29,7 @@ type FormEvent = | { type: "SHOW_FORGOT_PASSWORD" } | { type: "SUBMIT" } | { type: "BACKEND_INITIALIZED" } + | { type: "BACKEND_NOT_INITIALIZED" } | FormSuccessEvent | FormErrorEvent; @@ -63,7 +64,7 @@ const initialContext = {}; const machine = createMachine( { id: "loginForm", - initial: "backendInitializing", + initial: "signIn", context: initialContext, states: { ["signIn"]: { @@ -76,6 +77,9 @@ const machine = createMachine( target: "signingIn", actions: "reset", }, + BACKEND_NOT_INITIALIZED: { + target: "backendInitializing", + }, }, }, ["signingIn"]: { @@ -133,7 +137,7 @@ const machine = createMachine( ...(event as FormErrorEvent).detail, })), }, - }, + } ); @localized() @@ -295,11 +299,34 @@ export class LogInPage extends LiteElement { private renderBackendInitializing() { return html` +
- -

Please wait while the backend initializes

-
+ +
+
+ + + +

Please wait while the backend initializes

+
+
+
`; } @@ -346,11 +373,10 @@ export class LogInPage extends LiteElement { async checkBackendInitialized() { const resp = await fetch("/api/settings"); if (resp.status === 200) { - const Dialog = document.getElementById("backend-initializing"); - Dialog.close() this.formStateService.send("BACKEND_INITIALIZED"); } else { - setTimeout(this.checkBackendInitialized, 5000); + this.formStateService.send("BACKEND_NOT_INITIALIZED"); + setTimeout(() => this.checkBackendInitialized(), 5000); } } @@ -411,7 +437,7 @@ export class LogInPage extends LiteElement { type: "SUCCESS", detail: { successMessage: msg( - "Successfully received your request. You will receive an email to reset your password if your email is found in our system.", + "Successfully received your request. You will receive an email to reset your password if your email is found in our system." ), }, });