auto-commit for 8a62051e-b038-4363-a62d-7047e3d6e102

This commit is contained in:
emergent-agent-e1
2026-03-16 18:22:14 +00:00
parent 706e3e2eb6
commit 6a9e343332
16 changed files with 1510 additions and 212 deletions
+13 -6
View File
@@ -5,22 +5,29 @@ import { Button } from '../components/ui/button';
import { Input } from '../components/ui/input';
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '../components/ui/card';
import { toast } from 'sonner';
import { authAPI } from '../services/api';
const AdminLogin = () => {
const [email, setEmail] = useState('');
const [password, setPassword] = useState('');
const [loading, setLoading] = useState(false);
const navigate = useNavigate();
const handleLogin = (e) => {
const handleLogin = async (e) => {
e.preventDefault();
setLoading(true);
// Mock authentication - will be replaced with real backend
if (email === 'admin@epictravel.com' && password === 'admin123') {
try {
const response = await authAPI.login(email, password);
localStorage.setItem('auth_token', response.access_token);
localStorage.setItem('isAdminAuthenticated', 'true');
toast.success('Login successful!');
navigate('/admin/dashboard');
} else {
} catch (error) {
console.error('Login error:', error);
toast.error('Invalid credentials. Try: admin@epictravel.com / admin123');
} finally {
setLoading(false);
}
};
@@ -68,8 +75,8 @@ const AdminLogin = () => {
/>
</div>
</div>
<Button type="submit" className="w-full bg-cyan-600 hover:bg-cyan-700" size="lg">
Sign In
<Button type="submit" className="w-full bg-cyan-600 hover:bg-cyan-700" size="lg" disabled={loading}>
{loading ? 'Signing in...' : 'Sign In'}
</Button>
</form>
<div className="mt-6 p-4 bg-cyan-50 rounded-lg border border-cyan-200">