diff options
author | Sebastian <sebasjm@gmail.com> | 2023-12-06 15:17:23 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2023-12-06 15:17:23 -0300 |
commit | fa29c1494b029e195892d07dd74f4beebd78cf08 (patch) | |
tree | 4554d48f32072ba5f7bf7d02f9222a576ead9b88 | |
parent | dc02188d6bcae8446b27f0a094076fdd006931d1 (diff) | |
download | wallet-core-fa29c1494b029e195892d07dd74f4beebd78cf08.tar.xz |
show user if not logged out
-rw-r--r-- | packages/demobank-ui/src/pages/LoginForm.tsx | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/packages/demobank-ui/src/pages/LoginForm.tsx b/packages/demobank-ui/src/pages/LoginForm.tsx index e0ff77417..5eaad4bb0 100644 --- a/packages/demobank-ui/src/pages/LoginForm.tsx +++ b/packages/demobank-ui/src/pages/LoginForm.tsx @@ -31,13 +31,14 @@ import { assertUnreachable } from "./WithdrawalOperationPage.js"; export function LoginForm({ currentUser, fixedUser, onRegister }: { fixedUser?: boolean, currentUser?: string, onRegister?: () => void }): VNode { const backend = useBackendState(); - const [username, setUsername] = useState<string | undefined>(currentUser); + const sessionUser = backend.state.status !== "loggedOut" ? backend.state.username : undefined + const [username, setUsername] = useState<string | undefined>(currentUser ?? sessionUser); const [password, setPassword] = useState<string | undefined>(); const { i18n } = useTranslationContext(); const { api } = useBankCoreApiContext(); const [notification, notify, handleError] = useLocalNotification() const {config} = useBankCoreApiContext(); - + const ref = useRef<HTMLInputElement>(null); useEffect(function focusInput() { ref.current?.focus(); @@ -160,7 +161,7 @@ export function LoginForm({ currentUser, fixedUser, onRegister }: { fixedUser?: </div> </div> - {currentUser ? <div class="flex justify-between"> + {backend.state.status !== "loggedOut" ? <div class="flex justify-between"> <button type="submit" class="rounded-md bg-white-600 px-3 py-1.5 text-sm font-semibold leading-6 text-black shadow-sm hover:bg-gray-100 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-gray-600" onClick={(e) => { |