fixup
This commit is contained in:
parent
c5ca278253
commit
c7321fddfb
@ -12,11 +12,16 @@ import { getClientConfig } from "../config/client";
|
|||||||
|
|
||||||
export function AuthPage() {
|
export function AuthPage() {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const access = useAccessStore();
|
const accessStore = useAccessStore();
|
||||||
|
|
||||||
const goHome = () => navigate(Path.Home);
|
const goHome = () => navigate(Path.Home);
|
||||||
const goChat = () => navigate(Path.Chat);
|
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(() => {
|
useEffect(() => {
|
||||||
if (getClientConfig()?.isApp) {
|
if (getClientConfig()?.isApp) {
|
||||||
@ -38,21 +43,25 @@ export function AuthPage() {
|
|||||||
className={styles["auth-input"]}
|
className={styles["auth-input"]}
|
||||||
type="password"
|
type="password"
|
||||||
placeholder={Locale.Auth.Input}
|
placeholder={Locale.Auth.Input}
|
||||||
value={access.accessCode}
|
value={accessStore.accessCode}
|
||||||
onChange={(e) => {
|
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>
|
<div className={styles["auth-tips"]}>{Locale.Auth.SubTips}</div>
|
||||||
<input
|
<input
|
||||||
className={styles["auth-input"]}
|
className={styles["auth-input"]}
|
||||||
type="password"
|
type="password"
|
||||||
placeholder={Locale.Settings.Token.Placeholder}
|
placeholder={Locale.Settings.Token.Placeholder}
|
||||||
value={access.token}
|
value={accessStore.token}
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
access.updateToken(e.currentTarget.value);
|
accessStore.update(
|
||||||
|
(access) => (access.token = e.currentTarget.value),
|
||||||
|
);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user