import { useState } from 'react' import { useNavigate } from 'react-router-dom' import { useMutation } from '@tanstack/react-query' import { authApi } from '@/api/auth' import { useAuthStore } from '@/store/auth' export default function LoginPage() { const navigate = useNavigate() const setAuth = useAuthStore((state) => state.setAuth) const [username, setUsername] = useState('') const [password, setPassword] = useState('') const [error, setError] = useState('') const loginMutation = useMutation({ mutationFn: authApi.login, onSuccess: (data) => { setAuth(data.token, data.user) navigate('/') }, onError: (err: any) => { setError(err.response?.data?.error || 'Login failed') }, }) const handleSubmit = (e: React.FormEvent) => { e.preventDefault() setError('') loginMutation.mutate({ username, password }) } return ( <>
Dev Release V.1
{/* Subtitle */}Adastra Backup Storage Appliance
{/* Sign in instruction */}Sign in to your account