Merge pull request 'feat: add toast notifications for successful and failed login attempts' (#66) from dev into production
Reviewed-on: #66
This commit was merged in pull request #66.
This commit is contained in:
@@ -7,6 +7,7 @@ import Image from 'next/image'
|
||||
import { Space_Grotesk } from 'next/font/google'
|
||||
import { useAuth } from '@/contexts/auth-context'
|
||||
import { getApiError } from '@/lib/api'
|
||||
import { toast } from '@/components/ui/toast'
|
||||
import { Input } from '@/components/ui/input'
|
||||
import { Label } from '@/components/ui/label'
|
||||
import { Button } from '@/components/ui/button'
|
||||
@@ -32,8 +33,11 @@ export default function LoginPage() {
|
||||
setSubmitting(true)
|
||||
try {
|
||||
await login(identifier, password)
|
||||
toast.add({ title: 'Signed in successfully', type: 'success' })
|
||||
} catch (err) {
|
||||
setError(getApiError(err))
|
||||
const message = getApiError(err)
|
||||
setError(message)
|
||||
toast.add({ title: 'Sign in failed', description: message, type: 'error' })
|
||||
} finally {
|
||||
setSubmitting(false)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user