feat: add toast notifications for successful and failed login attempts
CI/CD - ERP Distribution / Build & Deploy Backend (pull_request) Failing after 12m53s
CI/CD - ERP Distribution / Build & Deploy Frontend (pull_request) Failing after 16m41s

This commit is contained in:
Kalana B. Thilakarathna
2026-10-19 02:50:06 +05:30
parent 7a21cde217
commit f44cbf711b
+5 -1
View File
@@ -7,6 +7,7 @@ import Image from 'next/image'
import { Space_Grotesk } from 'next/font/google' import { Space_Grotesk } from 'next/font/google'
import { useAuth } from '@/contexts/auth-context' import { useAuth } from '@/contexts/auth-context'
import { getApiError } from '@/lib/api' import { getApiError } from '@/lib/api'
import { toast } from '@/components/ui/toast'
import { Input } from '@/components/ui/input' import { Input } from '@/components/ui/input'
import { Label } from '@/components/ui/label' import { Label } from '@/components/ui/label'
import { Button } from '@/components/ui/button' import { Button } from '@/components/ui/button'
@@ -32,8 +33,11 @@ export default function LoginPage() {
setSubmitting(true) setSubmitting(true)
try { try {
await login(identifier, password) await login(identifier, password)
toast.add({ title: 'Signed in successfully', type: 'success' })
} catch (err) { } catch (err) {
setError(getApiError(err)) const message = getApiError(err)
setError(message)
toast.add({ title: 'Sign in failed', description: message, type: 'error' })
} finally { } finally {
setSubmitting(false) setSubmitting(false)
} }