Skip to content

Commit

Permalink
feat: Refactor AuthError component to use Suspense for loading state
Browse files Browse the repository at this point in the history
  • Loading branch information
kunaldevxxx committed Dec 19, 2024
1 parent 3ea051d commit 73b3692
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/app/auth/error/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

import { useSearchParams } from 'next/navigation'
import Link from 'next/link'
import { Suspense } from 'react'

export default function AuthError() {
function AuthErrorComponent() {
const searchParams = useSearchParams()
const errorMessage = searchParams?.get('message') || 'An unknown error occurred'

Expand All @@ -25,4 +26,12 @@ export default function AuthError() {
</div>
</div>
)
}
}

export default function AuthError() {
return (
<Suspense fallback={<div>Loading...</div>}>
<AuthErrorComponent />
</Suspense>
)
}

0 comments on commit 73b3692

Please sign in to comment.