diff --git a/public/404.html b/public/404.html index e31cd0b..8f017f3 100644 --- a/public/404.html +++ b/public/404.html @@ -3,22 +3,24 @@ - Redirecting... + Loading... -

Redirecting to the app...

+

Loading the application…

diff --git a/src/components/LoginForm.tsx b/src/components/LoginForm.tsx index cf7faef..1157367 100644 --- a/src/components/LoginForm.tsx +++ b/src/components/LoginForm.tsx @@ -12,6 +12,7 @@ const LoginForm: React.FC = () => { const [showPassword, setShowPassword] = useState(false); const [isLoading, setIsLoading] = useState(false); const [selectedUser, setSelectedUser] = useState(''); + const [errorMessage, setErrorMessage] = useState(null); const { login } = useUser(); const navigate = useNavigate(); @@ -23,15 +24,16 @@ const LoginForm: React.FC = () => { const matchedUser = userProfiles.find(u => u.email === email && u.password === password); if (!matchedUser) { setIsLoading(false); - alert('Login failed. Please check your credentials.'); + setErrorMessage('Login failed. Please check your credentials.'); return; } const success = await login(matchedUser.userId.toString(), email); setIsLoading(false); if (success) { + setErrorMessage(null); navigate('/products'); } else { - alert('Login failed. Please check your credentials.'); + setErrorMessage('Login failed. Please check your credentials.'); } }; @@ -51,6 +53,14 @@ const LoginForm: React.FC = () => { {/* Quick user selector keeps demo credentials handy */}
+ {errorMessage && ( +
+ {errorMessage} +
+ )}
{ title: 'Demo notification', description: 'Content Description button clicked!', className: toastStyles, - duration: 500 + duration: 5000 })} > Submit @@ -116,22 +166,20 @@ const Scenarios: React.FC = () => {
+ {lastCopiedLink && ( +
+ Last copied: {lastCopiedLink} +
+ )}