Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
Yidadaa committed Nov 7, 2023
1 parent c5ca278 commit c7321fd
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions app/components/auth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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 ? (
<>
<div className={styles["auth-tips"]}>{Locale.Auth.SubTips}</div>
<input
className={styles["auth-input"]}
type="password"
placeholder={Locale.Settings.Token.Placeholder}
value={access.token}
value={accessStore.token}
onChange={(e) => {
access.updateToken(e.currentTarget.value);
accessStore.update(
(access) => (access.token = e.currentTarget.value),
);
}}
/>
</>
Expand Down

0 comments on commit c7321fd

Please sign in to comment.