fix: pc端修改

This commit is contained in:
2025-08-06 00:38:29 -07:00
parent f6f5c2828b
commit 19fe24660e
142 changed files with 162226 additions and 851 deletions
+11 -4
View File
@@ -10,12 +10,13 @@ import {
NEXT_PUBLIC_DEFAULT_USER_EMAIL,
NEXT_PUBLIC_DEFAULT_USER_PASSWORD,
} from '@/config/constants';
import useGlobalStore from '@/config/use-global';
import { getRedirectUrl, setAuthorization } from '@/utils/common';
import LoginForm from './login-form';
import RegisterForm from './register-form';
import ResetForm from './reset-form';
export default function EmailAuthForm() {
export default function EmailAuthForm(props: { isRedirect: boolean; hide: () => void }) {
const t = useTranslations('auth');
const router = useRouter();
const [type, setType] = useState<'login' | 'register' | 'reset'>('login');
@@ -27,13 +28,19 @@ export default function EmailAuthForm() {
email: NEXT_PUBLIC_DEFAULT_USER_EMAIL,
password: NEXT_PUBLIC_DEFAULT_USER_PASSWORD,
});
const { getUserInfo } = useGlobalStore();
const handleFormSubmit = async (params: any) => {
const onLogin = async (token?: string) => {
if (!token) return;
setAuthorization(token);
router.replace(getRedirectUrl());
router.refresh();
if (props.isRedirect) {
router.replace(getRedirectUrl());
router.refresh();
} else {
await getUserInfo();
props.hide();
}
};
startTransition(async () => {
try {