mirror of
https://github.com/myronblair/epic-download
synced 2026-06-30 17:51:00 -05:00
auto-commit for 8a62051e-b038-4363-a62d-7047e3d6e102
This commit is contained in:
@@ -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">
|
||||
|
||||
Reference in New Issue
Block a user