feat: integrate sonner for toast notifications across multiple pages

This commit is contained in:
JSC
2025-07-05 17:49:12 +02:00
parent 06e0489923
commit 334ea9c391
6 changed files with 74 additions and 27 deletions

View File

@@ -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)
}