From da7e59a28a82c6b47ae44e84f2fad74b2d19001d Mon Sep 17 00:00:00 2001 From: Miodec Date: Thu, 14 Mar 2024 22:37:52 +0100 Subject: [PATCH] fix: website sometimes showing signup/login is disabled even though its not it was happening if the website loaded faster than the /configuration api call --- frontend/src/html/header.html | 2 +- frontend/src/html/pages/login.html | 6 +++--- frontend/src/ts/pages/login.ts | 9 --------- frontend/src/ts/ready.ts | 7 +++++-- 4 files changed, 9 insertions(+), 15 deletions(-) diff --git a/frontend/src/html/header.html b/frontend/src/html/header.html index 21716d4baa8e..5ebfe0bd89da 100644 --- a/frontend/src/html/header.html +++ b/frontend/src/html/header.html @@ -128,7 +128,7 @@

-
diff --git a/frontend/src/ts/pages/login.ts b/frontend/src/ts/pages/login.ts index c0b776391b22..30db07ba4482 100644 --- a/frontend/src/ts/pages/login.ts +++ b/frontend/src/ts/pages/login.ts @@ -6,7 +6,6 @@ import { InputIndicator } from "../elements/input-indicator"; import * as Skeleton from "../utils/skeleton"; import * as Misc from "../utils/misc"; import TypoList from "../utils/typo-list"; -import * as ServerConfiguration from "../ape/server-configuration"; export function enableSignUpButton(): void { $(".page.pageLogin .register.side button").prop("disabled", false); @@ -354,14 +353,6 @@ export const page = new Page( }, async () => { Skeleton.append("pageLogin", "main"); - if (ServerConfiguration.get()?.users.signUp) { - enableInputs(); - enableSignUpButton(); - - $(".register").removeClass("hidden"); - $(".login").removeClass("hidden"); - $(".disabledNotification").addClass("hidden"); - } }, async () => { // diff --git a/frontend/src/ts/ready.ts b/frontend/src/ts/ready.ts index 0392d91fea7b..ec35bcb52b6f 100644 --- a/frontend/src/ts/ready.ts +++ b/frontend/src/ts/ready.ts @@ -91,8 +91,11 @@ $(document).ready(() => { if (ConnectionState.get()) { void PSA.show(); void ServerConfiguration.sync().then(() => { - if (ServerConfiguration.get()?.users.signUp) { - $(".signInOut").removeClass("hidden"); + if (!ServerConfiguration.get()?.users.signUp) { + $(".signInOut").addClass("hidden"); + $(".register").addClass("hidden"); + $(".login").addClass("hidden"); + $(".disabledNotification").removeClass("hidden"); } }); }