feat: integrate sonner for toast notifications across multiple pages
This commit is contained in:
@@ -4,6 +4,7 @@ import { Button } from '@/components/ui/button'
|
||||
import { Input } from '@/components/ui/input'
|
||||
import { Label } from '@/components/ui/label'
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'
|
||||
import { toast } from 'sonner'
|
||||
import { useAuth } from '@/hooks/use-auth'
|
||||
import { authService } from '@/services/auth'
|
||||
|
||||
@@ -72,9 +73,12 @@ export function RegisterPage() {
|
||||
|
||||
try {
|
||||
await register(formData.email, formData.password, formData.name)
|
||||
toast.success('Account created successfully! Welcome!')
|
||||
navigate('/')
|
||||
} catch (error) {
|
||||
setError(error instanceof Error ? error.message : 'Registration failed')
|
||||
const errorMessage = error instanceof Error ? error.message : 'Registration failed'
|
||||
setError(errorMessage)
|
||||
toast.error(errorMessage)
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user