添加了postsPanel作为通用帖子显示板,增加了对jest测试的配置,添加了论坛主页,设定了论坛全局框架,设定了论坛基础主题色及主题切换、字号切换逻辑
Change-Id: I9fad0cf577088adb00c9850d405ccd23e6072413
diff --git a/src/views/login/login.tsx b/src/views/login/login.tsx
index 26b7842..bd429c7 100644
--- a/src/views/login/login.tsx
+++ b/src/views/login/login.tsx
@@ -8,21 +8,21 @@
import { useState } from 'react';
import { useSelector } from 'react-redux';
import { useNavigate } from 'react-router';
-import logo from '&/asserts/logo.png';
+import logo from '&/assets/logo.png';
import { getUserInfo } from '@/api/user';
-
+import debounce from 'lodash/debounce';
const Login: React.FC = () => {
const [email, setEmail] = useState('');
const [password, setPassword] = useState('');
const dispatch = useAppDispatch();
const { refresh: postUserLoginRefresh } = useApi(() => request.post(postUserLogin, {}), false);
- const { refresh: getUserInfoRefresh } = useApi(async () => await request.get(getUserInfo), false);
+ const { refresh: getUserInfoRefresh } = useApi(() => request.get(getUserInfo), false);
const nav = useNavigate();
- const handleLogin = async () => {
+ const handleLogin = debounce(async () => {
try {
- const res = await postUserLoginRefresh();
+ const res =await postUserLoginRefresh();
if (res==null ||(res as any).error) {
alert('Login failed. Please check your credentials.');
return;
@@ -44,14 +44,17 @@
console.error('Unknown error occurred');
}
}
- };
+ }, 1000) as () => void;
+ const handleLogoClick = () => {
+ nav('/');
+ }
return (
<div className={style.form}>
- <img className={style.logo} src={logo} alt="logo"></img>
+ <img className={style.logo} src={logo} alt="logo" onClick={handleLogoClick}></img>
<input type="email" value={email} onChange={(e) => setEmail(e.target.value)} className={style.email} placeholder="Enter your email" />
<input type="password" value={password} onChange={(e) => setPassword(e.target.value)} className={style.password} placeholder="Enter your password" />
- <button className={style.submit} onClick={handleLogin}>登录</button>
+ <button className={style.submit} onClick={() => handleLogin()}>登录</button>
<button className={style.register}>注册</button>
<button className={style.forget}> 忘记密码</button>
</div>