From c7321fddfbe92dc0e9ef81862aac3daa93653881 Mon Sep 17 00:00:00 2001 From: Yidadaa Date: Wed, 8 Nov 2023 00:34:31 +0800 Subject: [PATCH] fixup --- app/components/auth.tsx | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/app/components/auth.tsx b/app/components/auth.tsx index b82d0e894c7..577d7754240 100644 --- a/app/components/auth.tsx +++ b/app/components/auth.tsx @@ -12,11 +12,16 @@ import { getClientConfig } from "../config/client"; export function AuthPage() { const navigate = useNavigate(); - const access = useAccessStore(); + const accessStore = useAccessStore(); const goHome = () => navigate(Path.Home); const goChat = () => navigate(Path.Chat); - const resetAccessCode = () => { access.updateCode(""); access.updateToken(""); }; // Reset access code to empty string + const resetAccessCode = () => { + accessStore.update((access) => { + access.token = ""; + access.accessCode = ""; + }); + }; // Reset access code to empty string useEffect(() => { if (getClientConfig()?.isApp) { @@ -38,21 +43,25 @@ export function AuthPage() { className={styles["auth-input"]} type="password" placeholder={Locale.Auth.Input} - value={access.accessCode} + value={accessStore.accessCode} onChange={(e) => { - access.updateCode(e.currentTarget.value); + accessStore.update( + (access) => (access.accessCode = e.currentTarget.value), + ); }} /> - {!access.hideUserApiKey ? ( + {!accessStore.hideUserApiKey ? ( <>
{Locale.Auth.SubTips}
{ - access.updateToken(e.currentTarget.value); + accessStore.update( + (access) => (access.token = e.currentTarget.value), + ); }} />