zhizhi/writing-platform/frontend/src/pages/LoginPage.tsx

37 lines
1.2 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { useNavigate } from 'react-router-dom';
import PhoneLogin from '../components/PhoneLogin';
import { useAuth } from '../hooks/useAuth';
export default function LoginPage() {
const navigate = useNavigate();
const { setAuth } = useAuth();
const handleSuccess = (data: { token: string; user: any }) => {
setAuth(data.token, data.user);
navigate('/dashboard');
};
return (
<div className="min-h-screen pt-16 flex items-center justify-center px-4">
<div className="w-full max-w-md">
<div className="text-center mb-8">
<span className="text-4xl">🌟</span>
<h1 className="text-2xl font-bold text-ink-800 mt-3"></h1>
<p className="text-ink-500 text-sm mt-1"></p>
</div>
<div className="bg-white rounded-2xl shadow-soft p-8 border border-ink-100">
<PhoneLogin onSuccess={handleSuccess} buttonLabel="登录" />
</div>
<p className="text-center text-sm text-ink-400 mt-4">
{' '}
<a href="/writing/register" className="text-brand-600 hover:underline">
</a>
</p>
</div>
</div>
);
}