File tree Expand file tree Collapse file tree 2 files changed +18
-9
lines changed Expand file tree Collapse file tree 2 files changed +18
-9
lines changed Original file line number Diff line number Diff line change 11import type { Metadata } from "next" ;
22import { Inter } from "next/font/google" ;
33import "./globals.css" ;
4+ import { Toaster } from "react-hot-toast" ;
45
56const inter = Inter ( { subsets : [ "latin" ] } ) ;
67
78export const metadata : Metadata = {
8- title : "Plain support portal" ,
9- description : "Plain support portal example repo" ,
9+ title : "Plain support portal" ,
10+ description : "Plain support portal example repo" ,
1011} ;
1112
1213export default function RootLayout ( {
13- children,
14+ children,
1415} : Readonly < {
15- children : React . ReactNode ;
16+ children : React . ReactNode ;
1617} > ) {
17- return (
18- < html lang = "en" >
19- < body className = { inter . className } > { children } </ body >
20- </ html >
21- ) ;
18+ return (
19+ < html lang = "en" >
20+ < body className = { inter . className } >
21+ < >
22+ { children }
23+ < Toaster />
24+ </ >
25+ </ body >
26+ </ html >
27+ ) ;
2228}
Original file line number Diff line number Diff line change @@ -8,11 +8,13 @@ import { useState } from "react";
88import { RequestBody } from "@/app/api/contact-form/route" ;
99import { toast } from "react-hot-toast" ;
1010import { Button } from "@/components/button" ;
11+ import { useRouter } from "next/navigation" ;
1112
1213export default function NewThreadPage ( ) {
1314 const [ subject , setSubject ] = useState ( "" ) ;
1415 const [ message , setMessage ] = useState ( "" ) ;
1516 const [ isLoading , setIsLoading ] = useState ( false ) ;
17+ const router = useRouter ( ) ;
1618
1719 async function onSubmit ( e : React . FormEvent ) {
1820 e . preventDefault ( ) ;
@@ -30,6 +32,7 @@ export default function NewThreadPage() {
3032 } ) ;
3133 if ( result . ok ) {
3234 toast . success ( "Nice, we'll be in touch shortly!" ) ;
35+ router . push ( "/" ) ;
3336 } else {
3437 toast . error ( "Oops" ) ;
3538 }
You can’t perform that action at this time.
0 commit comments