mirror of
https://codeberg.org/MarkusThielker/next-ory.git
synced 2025-04-10 11:58:41 +00:00
Update ErrorPage to use Suspense for consistent error handling.
Read: https://nextjs.org/docs/messages/missing-suspense-with-csr-bailout
This commit is contained in:
parent
5c01f1a730
commit
015f04b76a
1 changed files with 12 additions and 4 deletions
|
@ -1,6 +1,6 @@
|
|||
'use client';
|
||||
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import React, {Suspense, useEffect, useState} from 'react';
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
import { FlowError } from '@ory/client';
|
||||
import { AxiosError } from 'axios';
|
||||
|
@ -9,7 +9,15 @@ import { useRouter, useSearchParams } from 'next/navigation';
|
|||
import Link from 'next/link';
|
||||
import { Button } from '@/components/ui/button';
|
||||
|
||||
export default function Error() {
|
||||
export default function ErrorPage() {
|
||||
return (
|
||||
<Suspense>
|
||||
<Error />
|
||||
</Suspense>
|
||||
)
|
||||
}
|
||||
|
||||
function Error() {
|
||||
|
||||
const [error, setError] = useState<FlowError>();
|
||||
|
||||
|
@ -62,10 +70,10 @@ export default function Error() {
|
|||
</CardContent>
|
||||
</Card>
|
||||
<Button asChild>
|
||||
<Link href="/" className="inline-flex space-x-2" passHref>
|
||||
<Link href="/" className="inline-flex space-x-2" passHref>
|
||||
Go back
|
||||
</Link>
|
||||
</Button>
|
||||
</>
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue