File tree 3 files changed +11
-2
lines changed
3 files changed +11
-2
lines changed Original file line number Diff line number Diff line change 9
9
} from "@/components/ui/card" ;
10
10
import { track } from "@vercel/analytics" ;
11
11
import Link from "next/link" ;
12
+ import { useRouter } from "next/navigation" ;
12
13
13
14
export default function ErrorPage ( {
14
15
error,
@@ -19,6 +20,7 @@ export default function ErrorPage({
19
20
} ) {
20
21
console . error ( { error } ) ;
21
22
track ( "Error page" ) ;
23
+ const router = useRouter ( ) ;
22
24
23
25
return (
24
26
< Card >
@@ -36,6 +38,9 @@ export default function ErrorPage({
36
38
< Button className = "w-full" onClick = { ( ) => reset ( ) } >
37
39
Try again
38
40
</ Button >
41
+ < Button className = "w-full" onClick = { ( ) => router . back ( ) } >
42
+ Go back
43
+ </ Button >
39
44
< Link href = "/support" className = "w-full" >
40
45
< Button variant = { "secondary" } className = "w-full" >
41
46
Tell us what happened
Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ export default async function GenerateImagePage(params: {
43
43
decodedPrompt,
44
44
} ) ;
45
45
46
- let generatedImageUrl : string ;
46
+ let generatedImageUrl : string | undefined ;
47
47
48
48
if ( isTestPrompt ) {
49
49
console . log (
Original file line number Diff line number Diff line change @@ -32,7 +32,11 @@ export const generateOpenAiImageUrl = async ({
32
32
style : "vivid" ,
33
33
} ) ;
34
34
35
- const url = response . data [ 0 ] . url ! ;
35
+ const url = response . data [ 0 ] . url ;
36
+ if ( ! url ) {
37
+ console . error ( "No url" ) ;
38
+ throw new Error ( "No url" ) ;
39
+ }
36
40
console . log ( "Generated image:" , { url } ) ;
37
41
38
42
return url ;
You can’t perform that action at this time.
0 commit comments